mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Fix pycryptodome not working on windows
This commit is contained in:
parent
c10abd4e76
commit
2966a3233d
@ -202,6 +202,16 @@ def freeze(env, ext_dir):
|
|||||||
shutil.copytree(j(comext, 'shell'), j(sp_dir, 'win32com', 'shell'))
|
shutil.copytree(j(comext, 'shell'), j(sp_dir, 'win32com', 'shell'))
|
||||||
shutil.rmtree(comext)
|
shutil.rmtree(comext)
|
||||||
|
|
||||||
|
# Fix pycryptodome
|
||||||
|
with open(j(sp_dir, 'Crypto', 'Util', '_file_system.py'), 'w') as fspy:
|
||||||
|
fspy.write('''
|
||||||
|
import os, sys
|
||||||
|
def pycryptodome_filename(dir_comps, filename):
|
||||||
|
base = os.path.join(sys.app_dir, 'app', 'bin')
|
||||||
|
path = os.path.join(base, '.'.join(dir_comps + [filename]))
|
||||||
|
return path
|
||||||
|
''')
|
||||||
|
|
||||||
pyqt = j(env.lib_dir, 'site-packages', 'PyQt5')
|
pyqt = j(env.lib_dir, 'site-packages', 'PyQt5')
|
||||||
for x in {x for x in os.listdir(pyqt) if x.endswith('.pyd')}:
|
for x in {x for x in os.listdir(pyqt) if x.endswith('.pyd')}:
|
||||||
if x.partition('.')[0] not in PYQT_MODULES and x != 'sip.pyd':
|
if x.partition('.')[0] not in PYQT_MODULES and x != 'sip.pyd':
|
||||||
|
@ -30,6 +30,8 @@ class BuildTest(unittest.TestCase):
|
|||||||
ctypes.WinDLL(native_string_type(os.path.join(base, x)))
|
ctypes.WinDLL(native_string_type(os.path.join(base, x)))
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.assertTrue(False, 'Failed to load DLL %s with error: %s' % (x, err))
|
self.assertTrue(False, 'Failed to load DLL %s with error: %s' % (x, err))
|
||||||
|
from Crypto.Cipher import AES
|
||||||
|
del AES
|
||||||
|
|
||||||
@unittest.skipUnless(islinux, 'DBUS only used on linux')
|
@unittest.skipUnless(islinux, 'DBUS only used on linux')
|
||||||
def test_dbus(self):
|
def test_dbus(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user