bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var#20605
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var#20605vstinner merged 2 commits into
Conversation
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA). Recognized GitHub usernameWe couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames: This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. You can check yourself to see if the CLA has been received. Thanks again for the contribution, we look forward to reviewing it! |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
See https://pythondev.readthedocs.io/pyconfig.html#add-an-environment-variable for the different steps to add a new environment variables:
- Update usage_xxx to document the new env var
- Doc/using/cmdline.rst: Document the new env var
- Misc/python.man: Document the new env var
- You may also mention it at https://docs.python.org/dev/library/sys.html#sys.platlibdir
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
|
@vstinner Thanks for your prompt feedback, I've reworked the PR |
Sorry, something went wrong.
|
@manisandro Could you please copy paste and use the phrase as suggested by the bot? It will label this PR accordingly. |
Sorry, something went wrong.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @vstinner: please review the changes made to this pull request. |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
Thanks, the update PR is much better! New review.
Please document also the new PyConfig field in https://docs.python.org/dev/c-api/init_config.html#c.PyConfig documentation with a ".. versionadded:: 3.10" markup.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @vstinner: please review the changes made to this pull request. |
Sorry, something went wrong.
|
It seems possible to test a custom PYTHONPATHLIBDIR in test_embed. At least, the following patch worked for me: |
Sorry, something went wrong.
|
Thanks, added to PR. |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
Ok, the PR now looks complete: all documentations are updated, thanks!
I didn't expect the new sys.platlibdir to land into PyConfig, but I think that I understood the rationale in https://bugs.python.org/issue40854
Overriding PYTHONHOME is uncommon. If you do that, I'm not surprised that you fall into corner cases. So having the ability to override platlibdir sounds reasonable.
Hum. It seems like PyConfig.platlibdir is a parameter which affects the "Path Configuration". So please add it to "Path configuration inputs" at:
https://docs.python.org/dev/c-api/init_config.html#path-configuration
Sorry, something went wrong.
|
Thanks, I've updated the PR accordingly. |
Sorry, something went wrong.
vstinner
left a comment
There was a problem hiding this comment.
Oh, one last request, sorry!
When you update a PR, please add a new commit rather than always rebase/squash your commits. New commits help to see what has been modified since my latest review.
Sorry, something went wrong.
|
No problem, pushed as new commit. |
Sorry, something went wrong.
|
Thanks, I merged your PR. |
Sorry, something went wrong.
|
Thank you for merging and for the review! |
Sorry, something went wrong.
You can currently point the python interpreter to a different install say via
With the newly added platlibdir [1], if python was configured with platlibdir=lib64, this will break because i.e. the site-packages dir as returned by
sysconfig.get_paths()will use lib64 and not lib as the other install may be using.This PR adds the possibility to override the platlibdir via environment variable.
Full rationale: [2].
[1] #8068
[2] https://src.fedoraproject.org/rpms/python3.9/pull-request/10
https://bugs.python.org/issue40854