-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Refactor wheel info extraction during install #7536
Refactor wheel info extraction during install #7536
Conversation
This will let us use the value for later processing.
This will let us re-use the wheel_metadata for other parts of processing, and by parameterizing checks in terms of metadata we will be able to substitute in metadata derived directly from the zip.
The _invalidversion_ tests are not applicable to the new function since we do not use a regex to find the applicable folder.
This will make it easier to transition to the already-determined dist-info directory and reduces some of our dependence on pkg_resources. Despite the name, the `egg_info` member is also populated for .dist-info dirs. ensure_str uses encoding='utf-8' and errors='strict' for Python 3 by default, which matches the behavior in `pkg_resources.NullProvider.get_metadata`.
Since retrieval of the .dist-info dir already ensures that a distribution is found, this reduces responsibility on wheel_metadata and lets us remove a few tests already covered by the tests for test_wheel_dist_info_dir_*.
|
||
info_dir_name = canonicalize_name(info_dir) | ||
canonical_name = canonicalize_name(name) | ||
if not info_dir_name.startswith(canonical_name): |
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.
nit (and for a follow-up PR): since we have canonicalized everything we might as well check for an exact match
if not info_dir_name[:-len('.dist-info')] == canonical_name
this would catch a messed-up wheel with canonical_name = foobar
and info_dir_name = foobar1234.dist-info
.
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.
Since the .dist-info
dir also has version, we would need that too.
This reorganizes and extracts some shared functionality out of
install_unpacked_wheel
into separate functions.In addition to setting us up for extracting metadata directly from wheel files (and installing directly from wheel files), this also:
pkg_resources
*.dist-info/WHEEL
that was being done for Path-Is-PurelibProgresses #7413, #6030, and the simplification of wheel builder mentioned in #7483 (comment).