Skip to content

Commit

Permalink
Merge pull request #8006 from uranusjr/fix-dist-name-parse
Browse files Browse the repository at this point in the history
Remove the version part from the dist-info directory name
  • Loading branch information
pfmoore authored Apr 9, 2020
2 parents c5da021 + d5e45bb commit d49b4da
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/pip/_internal/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,18 @@ def _get_dist(metadata_directory):
"""
dist_dir = metadata_directory.rstrip(os.sep)

# Build a PathMetadata object, from path to metadata. :wink:
base_dir, dist_dir_name = os.path.split(dist_dir)
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)

# Determine the correct Distribution object type.
if dist_dir.endswith(".egg-info"):
dist_cls = pkg_resources.Distribution
dist_name = os.path.splitext(dist_dir_name)[0]
else:
assert dist_dir.endswith(".dist-info")
dist_cls = pkg_resources.DistInfoDistribution

# Build a PathMetadata object, from path to metadata. :wink:
base_dir, dist_dir_name = os.path.split(dist_dir)
dist_name = os.path.splitext(dist_dir_name)[0]
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
dist_name = os.path.splitext(dist_dir_name)[0].split("-")[0]

return dist_cls(
base_dir,
Expand Down

0 comments on commit d49b4da

Please sign in to comment.