diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 5e8e63d5c4..1df0568b6c 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -25,6 +25,9 @@ from calibre.utils.filenames import ascii_filename as sanitize if isosx: usbobserver, usbobserver_err = plugins['usbobserver'] +def eject_exe(): + return os.path.join(os.path.dirname(sys.executable), 'calibre-eject.exe') + class USBDevice: def __init__(self, dev): @@ -918,8 +921,7 @@ class Device(DeviceConfig, DevicePlugin): def do_it2(drives): import win32process - EJECT = os.path.join(os.path.dirname(sys.executable), 'calibre-eject.exe') - subprocess.Popen([EJECT] + drives, creationflags=win32process.CREATE_NO_WINDOW).wait() + subprocess.Popen([eject_exe()] + drives, creationflags=win32process.CREATE_NO_WINDOW).wait() t = Thread(target=do_it2, args=[drives]) t.daemon = True diff --git a/src/calibre/test_build.py b/src/calibre/test_build.py index 6bb14796c6..55485c5ba2 100644 --- a/src/calibre/test_build.py +++ b/src/calibre/test_build.py @@ -12,7 +12,7 @@ __docformat__ = 'restructuredtext en' Test a binary calibre build to ensure that all needed binary images/libraries have loaded. ''' -import cStringIO, os, ctypes, shutil +import cStringIO, os, ctypes, shutil, sys from calibre import CurrentDir from calibre.constants import plugins, iswindows, islinux, isosx from calibre.ptempfile import TemporaryDirectory @@ -214,6 +214,24 @@ def test_tokenizer(): m.run_tests(for_build=True) print('tinycss tokenizer OK!') +def test_executables(): + from calibre.utils.ipc.launch import Worker + if getattr(sys, 'frozen', False): + w = Worker({}) + if not os.path.exists(w.executable): + raise SystemExit('calibre-parallel (%s) does not exist' % w.executable) + if not os.path.exists(w.gui_executable): + raise SystemExit('calibre-parallel-gui (%s) does not exist' % w.gui_executable) + if iswindows: + from calibre.devices.usbms.device import eject_exe + if not os.path.exists(eject_exe()): + raise SystemExit('calibre-eject.exe (%s) does not exist' % eject_exe()) + from calibre.ebooks.pdf.pdftohtml import PDFTOHTML + if not os.path.exists(PDFTOHTML): + raise SystemExit('pdftohtml (%s) does not exist' % PDFTOHTML) + + print('executables OK!') + def test_netifaces(): import netifaces if len(netifaces.interfaces()) < 1: @@ -262,6 +280,7 @@ def test(): if iswindows: test_dlls() test_plugins() + test_executables() test_image_compression() test_lzma() test_dukpy()