postinstall.py is trying to modify files in prefix.
When building cambalache for Arch I stumbled across a huge amount of permission errors, like
Running custom install script '/home/nils/.cache/yay/cambalache/src/cambalache-0.16.0/postinstall.py /usr/lib/python3.11/site-packages/'
Listing '/usr/lib/python3.11/site-packages/'...
Listing '/usr/lib/python3.11/site-packages/Automat-22.10.0-py3.11.egg-info'...
Listing '/usr/lib/python3.11/site-packages/Brotli-1.1.0.dist-info'...
Listing '/usr/lib/python3.11/site-packages/Crypto'...
Listing '/usr/lib/python3.11/site-packages/Crypto/Cipher'...
Compiling '/usr/lib/python3.11/site-packages/Crypto/Cipher/AES.py'...
*** PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.11/site-packages/Crypto/Cipher/__pycache__/AES.cpython-311.pyc.139890174181168'
Compiling '/usr/lib/python3.11/site-packages/Crypto/Cipher/ARC2.py'...
*** PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.11/site-packages/Crypto/Cipher/__pycache__/ARC2.cpython-311.pyc.139890174239936'
It seems that postinstall.py
is trying to compile all my .py
files in --prefix
, which in this case are /usr/lib/python3.11/site-packages/
. This luckily fails due to insufficient permissions.
Now I am not 100% sure why this step is needed, but it seems to me that maybe
compileall.compile_dir(sys.argv[1], force=True)
should be changed to
compileall.compile_dir(destdir, force=True)
so that the installation step is contained to --destdir
, and only modifies files there?
Edited by Nils Werner