-
-
Notifications
You must be signed in to change notification settings - Fork 247
Use the symlink-resolved location of Python in getpath on 3.14+ #896
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
Conversation
f6b631d to
43739ac
Compare
|
Passing the path the the executable via the |
|
With this patch the directory pointed to by The change from python/cpython#106045 (comment) (below) would update this path to the directory of the base_executable when it exists. I'm somewhat partial to that solution in addition to this change. @@ -411,6 +412,9 @@ def search_up(prefix, *landmarks, test=isfile):
if isfile(candidate):
base_executable = candidate
break
+ if base_executable and isfile(base_executable):
+ # Update the executable directory to be based on the resolved base executable
+ executable_dir = real_executable_dir = dirname(base_executable)
# home key found; stop iterating over lines
break |
|
I've found following helpful check/reproduce/debug this issue: |
|
Did you mean to close this? |
Nope, oops |
43739ac to
7e51c1e
Compare
|
I think adding both this patch and the one in #903 is a good idea, though even with both patches I would consider it not quite a complete fix. I've added some test cases based on #380 and #713. The patch in #903 by itself passes the tests for #380 but not the one in #713. (On the other hand the patch in #903 works on 3.11+.) Getting this patch to work for 3.11-3.13 isn't hard, but I'm not sure if I will get to that today. |
e0b5803 to
7033e22
Compare
7033e22 to
e1daa30
Compare
Patch CPython to allow venvs to be created from symlinks. When inside a venv and base_executable is passed available. Use the resolved path as the executable_dir rather than the one specified by home in pyvenv.cfg
| # TODO: does not yet work on ARM64 | ||
| # with self.subTest(msg="weird argv[0]"): | ||
| # assertPythonWorks(sys.executable, argv0="/dev/null") |
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.
Can this be a part of the skipif?
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.
I don't think you can skipIf a single subTest. You can call self.skipTest("doesn't yet work on arm64"). I probably could have structured this one as a separate test case, though....
|
Includes #903? |
|
Yes, to fix the aarch64 failures. |
Mostly fixes #380, and also fixes #713 because we prefer the actual
binary path to argv[0].