-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-45337: Use the realpath of the new executable when creating a venv on Windows #28663
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
…v on Windows. Also warn if the realpath does not match the user-specified location.
@@ -150,14 +150,17 @@ def test_prompt(self): | |||
def test_upgrade_dependencies(self): | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <steve.dower@python.org>
…v on Windows (pythonGH-28663) (cherry picked from commit 6811fda) Co-authored-by: Steve Dower <steve.dower@python.org>
Also warn if the realpath does not match the user-specified location.
https://bugs.python.org/issue45337