[sdk/pthon] Version Check: Handle virtual env correctly (#8465)

* Handle virtual env correctly

* Add CHANGELOG entry

* Correctly display which version is EOL
This commit is contained in:
Ian Wahbe 2021-11-19 15:21:13 -08:00 committed by GitHub
parent 7222e5570a
commit 87d8c7f074
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -21,5 +21,8 @@
- [codegen/typescript] - Respect default values in Pulumi object types.
[#8400](https://github.com/pulumi/pulumi/pull/8400)
- [cli] - Catch expected errors in filestate backend stacks.
- [sdk/python] - Correctly handle version checking python virtual environments.
[#8465](https://github.com/pulumi/pulumi/pull/8465)
- [cli] - Catch expected errors in stacks with filestate backends.
[#8455](https://github.com/pulumi/pulumi/pull/8455)

View file

@ -678,7 +678,7 @@ func validateVersion(virtualEnvPath string) {
var versionCmd *exec.Cmd
var err error
versionArgs := []string{"--version"}
if virtualEnvPath == "" {
if virtualEnvPath != "" {
versionCmd = python.VirtualEnvCommand(virtualEnvPath, "python", versionArgs...)
} else if versionCmd, err = python.Command(versionArgs...); err != nil {
fmt.Fprintf(os.Stderr, "Failed to find python executable\n")
@ -701,6 +701,6 @@ func validateVersion(virtualEnvPath string) {
} else if parsed.LT(eolPythonVersion) {
fmt.Fprintf(os.Stderr, "Python %d.%d is approaching EOL and will not be supported in Pulumi soon."+
" Check %s for more details\n", parsed.Major,
eolPythonVersion.Minor, eolPythonVersionIssue)
parsed.Minor, eolPythonVersionIssue)
}
}