Add build time test for executables

This commit is contained in:
Kovid Goyal 2015-12-07 12:34:31 +05:30
parent 0b1e77dd41
commit d9c57ad637
2 changed files with 24 additions and 3 deletions

View File

@ -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

View File

@ -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()