This repository was archived by the owner on Mar 27, 2024. It is now read-only.
Use PKG-INFO and METADATA to infer package names in pip analysis #292
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.
Fixes #287
This code adds improvements to the pip analyzer to produce more accurate results for installed Python packages, by using required (read: encouraged) metadata files in egg and wheel packages.
Some packages do not always adhere to these conventions, so in the event we can't use the expected metadata files, we fall back on the original heuristic of checking directories with similar names and assuming those are the corresponding directories. This code slightly modified this heuristic from checking the "previous alphabetical entry" to checking the previous and next entries, and doing a string comparison to match the package name. This gives more accurate results, for example with egg
bzr-2.8.0dev1.egg-info
and matching code directorybzrlib
.Note: this code modifies results from container-diff to include all installed python packages, not just those explicitly installed through pip. This means the results will be different than what is retrieved by running
pip list
, but gives more insight into what dependencies have been installed.