- Downloads
Use distutils from Python standard library
setuptools 60.0 switched from standard library distutils to its own
local distutils by default [1]. setuptools' own distutils version
doesn't support building with 2to3 translation anymore [2].
However, the current pycryptodomex version (3.6) relies on distutils
2to3 translation support for correct Python 3 builds. Building with the
setuptools distutils version results in run-time errors such as
. . .
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/cms-1.5.dev0-py3.8.egg/cmscommon/crypto.py", line 31, in <module>
from Cryptodome.Cipher import AES
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/Cryptodome/Cipher/__init__.py", line 31, in <module>
from Cryptodome.Cipher._mode_ctr import _create_ctr_cipher
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/Cryptodome/Cipher/_mode_ctr.py", line 37, in <module>
from Cryptodome.Util.number import long_to_bytes
File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/Cryptodome/Util/number.py", line 399
s = pack('>I', n & 0xffffffffL) + s
^
SyntaxError: invalid syntax
We set the SETUPTOOLS_USE_DISTUTILS environment variable to continue
using the system distutils version with 2to3 translation support for
now. The variable can be removed later when we update to a newer
pycryptodomex version.
In the documentation, we also pass the environment variable to the
"setup.py install" command for consistency.
[1] https://github.com/pypa/setuptools/commit/f7a55da560b35c5edff2795a5c9ee5ac3985668f
[2] https://github.com/pypa/setuptools/commit/d989cdb36f50785d23b07939ba8b4fc2b68cf02a
Please sign in to comment