version 0.4.80

This commit is contained in:
Kovid Goyal 2008-07-25 00:01:31 -07:00
parent 50add0c72d
commit 49f75513cf
3 changed files with 10 additions and 14 deletions

View File

@ -62,7 +62,7 @@ if __name__ == '__main__':
) )
if isosx: if isosx:
ext_modules.append(Extension('calibre.plugins.usbobserver', ext_modules.append(Extension('calibre.plugins.usbobserver',
sources=['src/calibre/driver/usbobserver/usbobserver.c']) sources=['src/calibre/devices/usbobserver/usbobserver.c'])
) )
def build_PyQt_extension(path): def build_PyQt_extension(path):

View File

@ -1,7 +1,7 @@
''' E-book management software''' ''' E-book management software'''
__license__ = 'GPL v3' __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>' __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
__version__ = '0.4.79' __version__ = '0.4.80'
__docformat__ = "epytext" __docformat__ = "epytext"
__author__ = "Kovid Goyal <kovid at kovidgoyal.net>" __author__ = "Kovid Goyal <kovid at kovidgoyal.net>"
__appname__ = 'calibre' __appname__ = 'calibre'
@ -61,7 +61,9 @@ if iswindows and getattr(sys, 'frozen', False):
plugins = {} plugins = {}
for plugin in ['pictureflow', 'lzx'] + (['winutil'] if iswindows else []): for plugin in ['pictureflow', 'lzx'] + \
(['winutil'] if iswindows else []) + \
(['usbobserver'] if isosx else []):
try: try:
p, err = __import__(plugin), '' p, err = __import__(plugin), ''
except Exception, err: except Exception, err:

View File

@ -12,12 +12,6 @@ from calibre.devices import libusb
osx_scanner = win_scanner = linux_scanner = None osx_scanner = win_scanner = linux_scanner = None
try:
import usbobserver
osx_scanner = usbobserver.get_devices
except ImportError:
pass
if iswindows: if iswindows:
try: try:
win_scanner = plugins['winutil'][0].get_usb_devices win_scanner = plugins['winutil'][0].get_usb_devices
@ -28,11 +22,11 @@ elif isosx:
osx_scanner = plugins['usbobserver'][0].get_usb_devices osx_scanner = plugins['usbobserver'][0].get_usb_devices
except: except:
raise RuntimeError('Failed to load the usbobserver plugin: %s'%plugins['usbobserver'][1]) raise RuntimeError('Failed to load the usbobserver plugin: %s'%plugins['usbobserver'][1])
else: else:
linux_scanner = libusb.get_devices linux_scanner = libusb.get_devices
class DeviceScanner(object): class DeviceScanner(object):
def __init__(self, *args): def __init__(self, *args):
if isosx and osx_scanner is None: if isosx and osx_scanner is None:
raise RuntimeError('The Python extension usbobserver must be available on OS X.') raise RuntimeError('The Python extension usbobserver must be available on OS X.')
@ -40,11 +34,11 @@ class DeviceScanner(object):
raise RuntimeError('DeviceScanner requires libusb to work.') raise RuntimeError('DeviceScanner requires libusb to work.')
self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner
self.devices = [] self.devices = []
def scan(self): def scan(self):
'''Fetch list of connected USB devices from operating system''' '''Fetch list of connected USB devices from operating system'''
self.devices = self.scanner() self.devices = self.scanner()
def is_device_connected(self, device): def is_device_connected(self, device):
if iswindows: if iswindows:
for device_id in self.devices: for device_id in self.devices:
@ -63,4 +57,4 @@ def main(args=sys.argv):
return 0 return 0
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())