mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix pyrcytodome not useable on macOS and Linux
This commit is contained in:
parent
3d89c98110
commit
2959f98698
@ -15,7 +15,9 @@ from functools import partial
|
|||||||
from bypy.constants import (
|
from bypy.constants import (
|
||||||
OUTPUT_DIR, PREFIX, SRC as CALIBRE_DIR, is64bit, python_major_minor_version
|
OUTPUT_DIR, PREFIX, SRC as CALIBRE_DIR, is64bit, python_major_minor_version
|
||||||
)
|
)
|
||||||
from bypy.freeze import extract_extension_modules, freeze_python, path_to_freeze_dir
|
from bypy.freeze import (
|
||||||
|
extract_extension_modules, fix_pycryptodome, freeze_python, path_to_freeze_dir
|
||||||
|
)
|
||||||
from bypy.utils import (
|
from bypy.utils import (
|
||||||
create_job, get_dll_path, mkdtemp, parallel_build, py_compile, run, walk
|
create_job, get_dll_path, mkdtemp, parallel_build, py_compile, run, walk
|
||||||
)
|
)
|
||||||
@ -158,6 +160,7 @@ def copy_python(env, ext_dir):
|
|||||||
pdir = j(env.lib_dir, 'calibre-extensions')
|
pdir = j(env.lib_dir, 'calibre-extensions')
|
||||||
if not os.path.exists(pdir):
|
if not os.path.exists(pdir):
|
||||||
os.mkdir(pdir)
|
os.mkdir(pdir)
|
||||||
|
fix_pycryptodome(j(env.py_dir, 'site-packages'))
|
||||||
for x in os.listdir(j(env.py_dir, 'site-packages')):
|
for x in os.listdir(j(env.py_dir, 'site-packages')):
|
||||||
os.rename(j(env.py_dir, 'site-packages', x), j(env.py_dir, x))
|
os.rename(j(env.py_dir, 'site-packages', x), j(env.py_dir, x))
|
||||||
os.rmdir(j(env.py_dir, 'site-packages'))
|
os.rmdir(j(env.py_dir, 'site-packages'))
|
||||||
|
@ -22,7 +22,9 @@ from itertools import repeat
|
|||||||
from bypy.constants import (
|
from bypy.constants import (
|
||||||
OUTPUT_DIR, PREFIX, PYTHON, SRC as CALIBRE_DIR, python_major_minor_version
|
OUTPUT_DIR, PREFIX, PYTHON, SRC as CALIBRE_DIR, python_major_minor_version
|
||||||
)
|
)
|
||||||
from bypy.freeze import extract_extension_modules, freeze_python, path_to_freeze_dir
|
from bypy.freeze import (
|
||||||
|
extract_extension_modules, fix_pycryptodome, freeze_python, path_to_freeze_dir
|
||||||
|
)
|
||||||
from bypy.utils import current_dir, mkdtemp, py_compile, timeit, walk
|
from bypy.utils import current_dir, mkdtemp, py_compile, timeit, walk
|
||||||
|
|
||||||
abspath, join, basename, dirname = os.path.abspath, os.path.join, os.path.basename, os.path.dirname
|
abspath, join, basename, dirname = os.path.abspath, os.path.join, os.path.basename, os.path.dirname
|
||||||
@ -545,6 +547,7 @@ class Freeze(object):
|
|||||||
finally:
|
finally:
|
||||||
if tdir is not None:
|
if tdir is not None:
|
||||||
shutil.rmtree(tdir)
|
shutil.rmtree(tdir)
|
||||||
|
fix_pycryptodome(self.site_packages)
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(join(self.site_packages, 'calibre', 'plugins'))
|
shutil.rmtree(join(self.site_packages, 'calibre', 'plugins'))
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
|
@ -30,6 +30,8 @@ class BuildTest(unittest.TestCase):
|
|||||||
ctypes.WinDLL(os.path.join(base, x))
|
ctypes.WinDLL(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))
|
||||||
|
|
||||||
|
def test_pycryptodome(self):
|
||||||
from Crypto.Cipher import AES
|
from Crypto.Cipher import AES
|
||||||
del AES
|
del AES
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user