-
Notifications
You must be signed in to change notification settings - Fork 60
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
Fix finding Python within virtualenv on Windows #2034
Conversation
a1fc119
to
7fbd9fe
Compare
7fbd9fe
to
3c3c172
Compare
libs/python/detect.go
Outdated
|
||
// On Windows when virtualenv is created, the <env>/Scripts directory | ||
// contains python.exe but no python3.exe. However, system python does have python3 entry | ||
// and it is also added to PATH, so it is found first. |
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.
Could this regress the non-venv cases where python.exe
resolves to a system-wide Python 2 installation?
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.
Maybe, if they somehow managed to have Python2 installed in the first place, but why would they have that?
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 see python3 mentioned in another place in this module - it also won't work.
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.
Does it matter which Windows terminal is being used? Some users might use Git Bash for example and maybe the behaviour is different?
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.
that should not matter
) | ||
|
||
func TestVenv(t *testing.T) { | ||
// Test at least two version to ensure we capture a case where venv version does not match system one |
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.
Smart :)
this new function does not change chdir or sets environment
Test Details: go/deco-tests/12409928666 |
libs/python/detect.go
Outdated
|
||
// On Windows when virtualenv is created, the <env>/Scripts directory | ||
// contains python.exe but no python3.exe. However, system python does have python3 entry | ||
// and it is also added to PATH, so it is found first. |
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.
Does it matter which Windows terminal is being used? Some users might use Git Bash for example and maybe the behaviour is different?
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Bundles: * Fix finding Python within virtualenv on Windows ([#2034](#2034)). * Include missing field descriptions in JSON schema ([#2045](#2045)). * Add validation for volume referenced from `artifact_path` ([#2050](#2050)). * Handle `${workspace.file_path}` references in source-linked deployments ([#2046](#2046)). * Set the write bit for files written during template initialization ([#2068](#2068)).
Bundles: * Fix finding Python within virtualenv on Windows ([#2034](#2034)). * Include missing field descriptions in JSON schema ([#2045](#2045)). * Add validation for volume referenced from `artifact_path` ([#2050](#2050)). * Handle `${workspace.file_path}` references in source-linked deployments ([#2046](#2046)). * Set the write bit for files written during template initialization ([#2068](#2068)).
Changes
Simplify logic for selecting Python to run when calculating default whl build command: "python" on Windows and "python3" everywhere.
Python installers from python.org do not install python3.exe. In virtualenv there is no python3.exe.
Tests
Added new unit tests to create real venv with uv and simulate activation by prepending venv/bin to PATH.