bpo-45337: Use the realpath of the new executable when creating a venv on Windows#28663
bpo-45337: Use the realpath of the new executable when creating a venv on Windows#28663zooba merged 6 commits intopython:mainfrom
Conversation
…v on Windows. Also warn if the realpath does not match the user-specified location.
| builder = venv.EnvBuilder() | ||
| bin_path = 'Scripts' if sys.platform == 'win32' else 'bin' | ||
| python_exe = 'python.exe' if sys.platform == 'win32' else 'python' | ||
| python_exe = os.path.split(sys.executable)[1] |
There was a problem hiding this comment.
Is it possible that sys.executable will be called something other than python.exe? Perhaps python3.exe? AFAIK only python.exe and pythonw.exe will be added to the venv being created.
There was a problem hiding this comment.
It can be. python_d.exe is the only one we support upstream, but I'd like it to be viable with other names (I have some private builds with alternate executable names).
But right now it doesn't work anyway. The venv launcher executable has hardcoded names in it, so it'll only work as python.exe, python_d.exe, pythonw.exe and pythonw_d.exe. Which means that this test is basically correct, unless we one day start running our test suite with a different executable name.
|
I triggered the buildbots mainly to test the new one we just added, this PR is still very open for updates :) |
|
I see what you're trying to do here. In fact, I can't find a way to do it any better myself. That being said, I have a (minor) concern. Your introduction of |
Perhaps just documenting explicitly what they're for/why they're used would help, in particular if any other issues in this area come up relating to the MS-Store version of Python. |
I referenced the bug as an example of why we'd need this - unfortunately, this side of things keeps changing on the OS side too often, so I'm very hesitant to pretend in our source code that it's a known thing. Also changed the member name to |
|
Thanks @zooba for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
|
GH-28810 is a backport of this pull request to the 3.10 branch. |
|
Hopefully there were no further concerns. We've got time to fix them up if so |
|
GH-28811 is a backport of this pull request to the 3.9 branch. |
…v on Windows (pythonGH-28663) (cherry picked from commit 6811fda) Co-authored-by: Steve Dower <[email protected]>
…v on Windows (pythonGH-28663) (cherry picked from commit 6811fda) Co-authored-by: Steve Dower <[email protected]>
…v on Windows (GH-28663) (cherry picked from commit 6811fda) Co-authored-by: Steve Dower <[email protected]>
…v on Windows (GH-28663) (cherry picked from commit 6811fda) Co-authored-by: Steve Dower <[email protected]>
Also warn if the realpath does not match the user-specified location.
https://bugs.python.org/issue45337