-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Set 'home' to parent directory of system_executable #2441
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs test too 👍
I don't mind stashing a test in some current unittest, but when i glanced around i didn't see any existing tests really validating the contents of pyvenv.cfg. Do you have a suggestion on where to place a test for this? |
8f5b8ee
to
6843472
Compare
6843472
to
c12355b
Compare
I'm a little confused by the failure on the macos-12 3.8 pipeline that doesn't occur in 3.9. I don't have a mac to test and debug this on. One thing I could do is skip this for def set_pyenv_cfg(self):
# prefer venv options over ours, but keep our extra
venv_content = copy(self.pyenv_cfg.refresh())
super().set_pyenv_cfg()
self.pyenv_cfg.update(venv_content) otherwise i'm not sure what the nuance is. The native I see
unless there's a symlink between https://github.com/python/cpython/blob/3.8/Modules/getpath.c#L1234 which happens before https://github.com/python/cpython/blob/3.8/Modules/getpath.c#L1242 unless the test I wrote isn't actually testing what i thought it was |
Seems we're failing on ubuntu too, can you take a look? |
Looks related to installing
|
c12355b
to
98414d8
Compare
This still seems to be failling on macos 🤔 |
I'll try to setup a VM with MacOS 12 and see if i can recreate it... it's just odd that it fails on 3.8 but not 3.9 |
brew macos is weird like that 🤦 they change the layout every version, e.g. 3.9 and 3.10 does not even pass our test suite... |
well, i can still try to setup a VM to debug this. trying to debug it through a CI pipeline seems insane. If you have hardware and can help debug that'd be great. I probably won't be able to get around to this for the next few days however. My guess is it's a symlink issue and that maybe i need to or if there's a way for me to mark this as skip, i can do that too if that's your preference. |
PEP 405 says of the "home" key: "If a home key is found, this signifies that the Python binary belongs to a virtual environment, and the value of the home key is the directory containing the Python executable used to create this virtual environment." And: "In this case, prefix-finding continues as normal using the value of the home key as the effective Python binary location, which finds the prefix of the base installation." Previously, "home" was being set to `interpreter.system_exec_prefix` which does not abide by the PEP specification. In Python 3.11, the "home" directory is used to determine the value of `sys._base_executable`, so if the path specified is incorrect, the path + interpreter returned will be invalid. This can cause headaches later when trying to probe info via the discovery module. Now, set this to the parent directory of `interpreter.system_executable`. Signed-off-by: Vincent Fazio <vfazio@gmail.com>
98414d8
to
812b26f
Compare
As suspected:
So certain code paths will end up using "resolved" paths and others won't. So instead of doing an explicit path comparison, i'm just going to check that python exists in the path pointed to by the "home" key, regardless of if |
There is no reason why that ubuntu 3.11 pipeline should be failing... it seems to imply that |
PEP 405 says of the "home" key:
"If a home key is found, this signifies that the Python binary belongs to a virtual environment, and the value of the home key is the directory containing the Python executable used to create this virtual environment."
And:
"In this case, prefix-finding continues as normal using the value of the home key as the effective Python binary location, which finds the prefix of the base installation."
Previously, "home" was being set to
interpreter.system_exec_prefix
which does not abide by the PEP specification.In Python 3.11, the "home" directory is used to determine the value of
sys._base_executable
, so if the path specified is incorrect, the path + interpreter returned will be invalid. This can cause headaches later when trying to probe info via the discovery module.Now, set this to the parent directory of
interpreter.system_executable
.close #2440
It may not resolve the problem fully as virtualenv cannot control the
sys._base_executable
"calculation" short of specifying the home directory. This means there's still a chance that a path to "python" gets returned even though there may not be one available in the parent-most non-venv python directory (the python interpreter path that created the upper-most venv).Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)!
tox -e fix_lint
)docs/changelog
folder