Cantera / cantera

Chemical kinetics, thermodynamics, and transport tool suite
https://cantera.org
Other
602 stars 346 forks source link

Installed *.pyc files refer to the stage directory #1601

Closed yurivict closed 1 year ago

yurivict commented 1 year ago

When Pythjon bindings are installed *.pyc files refer to the stage directory where they are installed.

Here is the error log that the FreeBSD port prints:

====> Running Q/A tests (stage-qa)
Error: 'lib/python3.9/site-packages/cantera/with_units/__pycache__/__init__.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/with_units/__pycache__/solution.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/composite.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/__init__.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/ck2yaml.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/ctml2yaml.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/cti2yaml.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/interrupts.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/data.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/liquidvapor.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/onedim.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/utils.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Error: 'lib/python3.9/site-packages/cantera/__pycache__/yaml2ck.cpython-39.pyc' is referring to /usr/ports/science/cantera/work/stage
Warning: 'lib/libcantera_python3_9.so' is not stripped consider trying INSTALL_TARGET=install-strip or using ${STRIP_CMD}

Version: 3.0.0 Python-3.9 FreeBSD 13.2

speth commented 1 year ago

Did this happen in 2.6.0 or 3.0.0b1 as well, or is this a new problem?

yurivict commented 1 year ago

2.6.0 had some other problem with Python bindings so they weren't built. I didn't try 3.0.0b1.

speth commented 1 year ago

I think this is the same as https://github.com/pypa/pip/issues/11317, which you also reported. I don't think there's anything we can do within Cantera to resolve this problem.

One general solution to this that I'm aware of is what Debian/Ubuntu do, which is not to package the .pyc files, and to then do the byte-compilation step using a post-install hook, when the files will all be installed in their final locations.

band-a-prend commented 1 year ago

@yurivict In Gentoo I have to run helper function to recompile python bytecode on install phase.

In FreeBSD maybe similar could be done, e.g. like in gpsd package in post-install: section.

ischoegl commented 1 year ago

As posts above indicate, it doesn't appear to be an issue that requires resolution: .pyc files should not be packaged; instead, they should be generated during installation in a final location. If this is different for FreeBSD, please feel free to reopen and provide further context.