Skip to content

Commit d49b4da

Browse files
authored
Merge pull request #8006 from uranusjr/fix-dist-name-parse
Remove the version part from the dist-info directory name
2 parents c5da021 + d5e45bb commit d49b4da

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/pip/_internal/req/req_install.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,18 @@ def _get_dist(metadata_directory):
7070
"""
7171
dist_dir = metadata_directory.rstrip(os.sep)
7272

73+
# Build a PathMetadata object, from path to metadata. :wink:
74+
base_dir, dist_dir_name = os.path.split(dist_dir)
75+
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
76+
7377
# Determine the correct Distribution object type.
7478
if dist_dir.endswith(".egg-info"):
7579
dist_cls = pkg_resources.Distribution
80+
dist_name = os.path.splitext(dist_dir_name)[0]
7681
else:
7782
assert dist_dir.endswith(".dist-info")
7883
dist_cls = pkg_resources.DistInfoDistribution
79-
80-
# Build a PathMetadata object, from path to metadata. :wink:
81-
base_dir, dist_dir_name = os.path.split(dist_dir)
82-
dist_name = os.path.splitext(dist_dir_name)[0]
83-
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
84+
dist_name = os.path.splitext(dist_dir_name)[0].split("-")[0]
8485

8586
return dist_cls(
8687
base_dir,

0 commit comments

Comments
 (0)