Fix pycryptodome not working on windows

This commit is contained in:
Kovid Goyal 2019-12-18 09:25:35 +05:30
parent c10abd4e76
commit 2966a3233d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 0 deletions

View File

@ -202,6 +202,16 @@ def freeze(env, ext_dir):
shutil.copytree(j(comext, 'shell'), j(sp_dir, 'win32com', 'shell'))
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')
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':

View File

@ -30,6 +30,8 @@ class BuildTest(unittest.TestCase):
ctypes.WinDLL(native_string_type(os.path.join(base, x)))
except Exception as 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')
def test_dbus(self):