Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow python3 site-package to be modified #72

Conversation

olivier-roussel
Copy link
Contributor

For python 3, the CMakeLists sets the SP3_PYTHON_PACKAGES_DIRECTORY cmake variable to python3/site-package. However, a more standard approach is to install to the site-package directory in the form python<X.Y>/site-package for a Python version X.Y, as it is then automatically imported by default thanks to the site module (see https://docs.python.org/3/library/site.html#module-site ).
Also, whereas it is possible to change the SP3_PYTHON_PACKAGES_DIRECTORY cmake variable for SofaPython3 (e.g. to the pythonX.Y/site-package value), it cannot be changed for this plugin, so the python3/site-package value is fixed. This leads to an inconsistent python packages installation if SP3_PYTHON_PACKAGES_DIRECTORY has been changed in SofaPython3 install.
This PR would enable to automatically inherits by default the value of SP3_PYTHON_PACKAGES_DIRECTORY that is read from the SofaPython3Config.cmake at the find_package(SofaPython3) call, and which corresponds to the SP3_PYTHON_PACKAGES_DIRECTORY of the SofaPython3 python packages directory. If SofaPython3 is not found, then SP3_PYTHON_PACKAGES_DIRECTORY won't be set and still can be user defined at the cmake configure, or just kept unspecified and then it will fallback to its default value.

Side question: Is there any particular reason to install by default into python<X>/site-package instead of python<X.Y>/site-package in general for the SOFA framework ? If no, may be we could migrate to this path, it could ease the python installation.

@damienmarchal
Copy link
Member

Agreed for more consistency between sofa modules.

For the python3, I see two historical reasons... the first one is that this is a side effect having named python3 the directory for python3 modules in sofa plugin to differentiate from python (aka python2) ones. The second one is that it probably also tooks its root from the fact that debian & ubuntu have their own convention with python3/dist-package in addition to pythonX.Y/diste-packages & .local/pythonX.Y/site-packages

@alxbilger
Copy link
Member

Ready to merge?

@VannesteFelix
Copy link
Collaborator

Thank you @olivier-roussel.
Seems good to me, will relaunch the CI to check then merge.

@alxbilger alxbilger force-pushed the allow-reuse-edit-set-python-sp-path branch from 82ce819 to 568cae6 Compare October 12, 2023 10:17
@VannesteFelix VannesteFelix merged commit bd49c19 into SofaDefrost:master Oct 12, 2023
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants