FS#70258 - [python-pycryptodome] Somehow avoid running gcc at import time
Attached to Project:
Community Packages
Opened by Mantas Mikulėnas (grawity) - Thursday, 01 April 2021, 19:25 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 09 May 2023, 03:50 GMT
Opened by Mantas Mikulėnas (grawity) - Thursday, 01 April 2021, 19:25 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 09 May 2023, 03:50 GMT
|
Details
With Cryptodome 3.10, doing `import Crypto.Cipher.AES` will
spawn gcc ~18 times *during import*, i.e. every time the
program starts up. This takes ~500ms, so in my case
importing Crypto takes several times longer than running the
actual program that uses it.
(Apparently this was not the case in Cryptodome 3.9.) According to #python, this is done by cffi. Is it possible to make it do the necessary things at package build time, instead of import time? (I mean, without uninstalling python-cffi, because I have other packages which need it.) |
This task depends upon
Closed by Toolybird (Toolybird)
Tuesday, 09 May 2023, 03:50 GMT
Reason for closing: Fixed
Additional comments about closing: python-pycryptodome 3.10.4-1
Tuesday, 09 May 2023, 03:50 GMT
Reason for closing: Fixed
Additional comments about closing: python-pycryptodome 3.10.4-1
load_lib() tries to cffi.FFI().dlopen() the full path to a filename, and if it fails because the filename does not exist, it runs the compiler weirdly, does nothing with it, and raises OSError.
load_pycryptodome_raw_lib() tries to load several different possible versions of any given *.so filename, and in the process uses a try/except for load_lib() which succeeds after a couple different filenames.
The upstream import shim looks... nuts...