Repository navigation
fix(python-pip): find a wheel's .data directory by its filename name - #988
Open
olucasleitedev wants to merge 1 commit into
Open
olucasleitedev wants to merge 1 commit into
olucasleitedev wants to merge 1 commit into
Conversation
Package.data_dir built the {distribution}-{version}.data directory name
from the PEP 503 normalized package name (foo-bar), but a wheel names
that directory with the escaped name from its filename (foo_bar, per
PEP 427). For any package whose name contains "_", "-" or "." (or upper
case letters, on case-sensitive file systems) the directory was never
found, so modules shipped under .data/purelib or .data/platlib were left
inside it and could not be imported in the Lambda package.
Build the directory name from the wheel filename instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #, if available: N/A (same bug as aws/chalice#1356, which this packager was derived from)
Description of changes
Package.data_dirbuilt the{distribution}-{version}.dataname from the PEP 503 normalized package name (foo-bar), but wheels name that directory with the escaped name from the wheel filename (foo_bar, PEP 427). For packages whose name contains_,-or.(or upper-case letters, on case-sensitive file systems),_install_purelib_and_platlibnever found the directory, so modules shipped under.data/purelibor.data/platlibstayed inside it and could not be imported on Lambda. chalice hit the same bug with an SQLAlchemy wheel built from its sdist (SQLAlchemy-1.3.9.data/purelib/sqlalchemy/...).data_dirnow uses the name and version from the wheel filename. The unit test that asserted the normalized name is updated.Description of how you validated changes
foo_bar-1.2-...whlcontainingfoo_bar-1.2.data/purelib/foo_bar/. It fails ondevelop(onlyfoo_bar-1.2.dataends up in site-packages) and passes with the fix.pytest tests/unit/workflows/python_pip tests/functional/workflows/python_pip: 204 passed, 1 skipped.black --checkandruff checkpass.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.