mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
version 0.4.80
This commit is contained in:
parent
50add0c72d
commit
49f75513cf
2
setup.py
2
setup.py
@ -62,7 +62,7 @@ if __name__ == '__main__':
|
||||
)
|
||||
if isosx:
|
||||
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):
|
||||
|
@ -1,7 +1,7 @@
|
||||
''' E-book management software'''
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
__version__ = '0.4.79'
|
||||
__version__ = '0.4.80'
|
||||
__docformat__ = "epytext"
|
||||
__author__ = "Kovid Goyal <kovid at kovidgoyal.net>"
|
||||
__appname__ = 'calibre'
|
||||
@ -61,7 +61,9 @@ if iswindows and getattr(sys, 'frozen', False):
|
||||
|
||||
|
||||
plugins = {}
|
||||
for plugin in ['pictureflow', 'lzx'] + (['winutil'] if iswindows else []):
|
||||
for plugin in ['pictureflow', 'lzx'] + \
|
||||
(['winutil'] if iswindows else []) + \
|
||||
(['usbobserver'] if isosx else []):
|
||||
try:
|
||||
p, err = __import__(plugin), ''
|
||||
except Exception, err:
|
||||
|
@ -12,12 +12,6 @@ from calibre.devices import libusb
|
||||
|
||||
osx_scanner = win_scanner = linux_scanner = None
|
||||
|
||||
try:
|
||||
import usbobserver
|
||||
osx_scanner = usbobserver.get_devices
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if iswindows:
|
||||
try:
|
||||
win_scanner = plugins['winutil'][0].get_usb_devices
|
||||
@ -28,11 +22,11 @@ elif isosx:
|
||||
osx_scanner = plugins['usbobserver'][0].get_usb_devices
|
||||
except:
|
||||
raise RuntimeError('Failed to load the usbobserver plugin: %s'%plugins['usbobserver'][1])
|
||||
else:
|
||||
else:
|
||||
linux_scanner = libusb.get_devices
|
||||
|
||||
class DeviceScanner(object):
|
||||
|
||||
|
||||
def __init__(self, *args):
|
||||
if isosx and osx_scanner is None:
|
||||
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.')
|
||||
self.scanner = win_scanner if iswindows else osx_scanner if isosx else linux_scanner
|
||||
self.devices = []
|
||||
|
||||
|
||||
def scan(self):
|
||||
'''Fetch list of connected USB devices from operating system'''
|
||||
self.devices = self.scanner()
|
||||
|
||||
|
||||
def is_device_connected(self, device):
|
||||
if iswindows:
|
||||
for device_id in self.devices:
|
||||
@ -63,4 +57,4 @@ def main(args=sys.argv):
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
sys.exit(main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user