Skip to content

Commit 1152bd1

Browse files
authored
Fix entry point discovery on Windows. (bazel-contrib#572)
The zipfile module always uses forward slashes, so we shouldn't use os.path.join here.
1 parent 661d527 commit 1152bd1

File tree

1 file changed

+6
-3
lines changed
  • python/pip_install/extract_wheels/lib

1 file changed

+6
-3
lines changed

python/pip_install/extract_wheels/lib/wheel.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ def entry_points(self) -> Dict[str, str]:
5555
# Calculate the location of the entry_points.txt file
5656
metadata = self.metadata
5757
name = "{}-{}".format(metadata.name.replace("-", "_"), metadata.version)
58-
entry_points_path = os.path.join(
59-
"{}.dist-info".format(name), "entry_points.txt"
60-
)
58+
# Note that the zipfile module always uses the forward slash as
59+
# directory separator, even on Windows, so don't use os.path.join
60+
# here. Reference for Python 3.10:
61+
# https://github.com/python/cpython/blob/3.10/Lib/zipfile.py#L355.
62+
# TODO: use zipfile.Path once 3.8 is our minimum supported version
63+
entry_points_path = "{}.dist-info/entry_points.txt".format(name)
6164

6265
# If this file does not exist in the wheel, there are no entry points
6366
if entry_points_path not in whl.namelist():

0 commit comments

Comments
 (0)