-
Notifications
You must be signed in to change notification settings - Fork 820
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: get pipenv py version from Pipfile #7254
Conversation
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.
LGTM with a question.
@@ -13,8 +14,7 @@ export async function getPipenvDir(srcRoot: string): Promise<string> { | |||
throw new Error(`Could not find 'python3' or 'python' executable in the PATH.`); | |||
} | |||
|
|||
const pyVersion = await execAsStringPromise(`${pyBinary} --version`); | |||
let pipEnvPath = path.join(pipEnvDir, 'lib', 'python' + majMinPyVersion(pyVersion), 'site-packages'); | |||
let pipEnvPath = path.join(pipEnvDir, 'lib', `python${getPipfilePyVersion(path.join(srcRoot, 'Pipfile'))}`, 'site-packages'); |
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.
Would there be any benefit to falling back to majMinPyVersion()
if getPipfilePyVersion()
fails?
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.
If there's no version specified in the Pipfile, creating the virtual env wont even work so I don't think we need a fallback here
👋 Hi, this pull request was referenced in the v4.51.0 release! Check out the release notes here https://github.com/aws-amplify/amplify-cli/releases/tag/v4.51.0. |
When resolving the virtual env site packages file, the path was constructed using the system python version rather than the virtual env python version. This change constructs the path by parsing the PIpenv file and using the python version found there
Description of changes
When resolving the virtual env site packages file, the path was constructed using the system python version rather than the virtual env python version. This change constructs the path by parsing the PIpenv file and using the python version found there
Issue #, if available
#7188
Description of how you validated changes
Manually tested. Existing E2E tests cover creating building and packaging python functions
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.