From 6188513a028b28fef9d033b6bfa9d8c536f83f4b Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Wed, 17 Nov 2021 15:13:14 +0100 Subject: [PATCH 1/3] Fix entry point discovery on Windows. The zipfile module always uses forward slashes, so we shouldn't use os.path.join here. --- python/pip_install/extract_wheels/lib/wheel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/pip_install/extract_wheels/lib/wheel.py b/python/pip_install/extract_wheels/lib/wheel.py index fadf8af436..e88dcbfbf6 100644 --- a/python/pip_install/extract_wheels/lib/wheel.py +++ b/python/pip_install/extract_wheels/lib/wheel.py @@ -55,9 +55,10 @@ def entry_points(self) -> Dict[str, str]: # Calculate the location of the entry_points.txt file metadata = self.metadata name = "{}-{}".format(metadata.name.replace("-", "_"), metadata.version) - entry_points_path = os.path.join( - "{}.dist-info".format(name), "entry_points.txt" - ) + # Note that the zipfile module always uses the forward slash as + # directory separator, even on Windows, so don't use os.path.join + # here. + entry_points_path = "{}.dist-info/entry_points.txt".format(name) # If this file does not exist in the wheel, there are no entry points if entry_points_path not in whl.namelist(): From 5fd5bd1aabe16fd58c91d4b2a0bd3077927d19cc Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 27 Nov 2021 16:31:03 +0100 Subject: [PATCH 2/3] Update python/pip_install/extract_wheels/lib/wheel.py Co-authored-by: Jonathon Belotti --- python/pip_install/extract_wheels/lib/wheel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/pip_install/extract_wheels/lib/wheel.py b/python/pip_install/extract_wheels/lib/wheel.py index e88dcbfbf6..5dc6708712 100644 --- a/python/pip_install/extract_wheels/lib/wheel.py +++ b/python/pip_install/extract_wheels/lib/wheel.py @@ -58,6 +58,7 @@ def entry_points(self) -> Dict[str, str]: # Note that the zipfile module always uses the forward slash as # directory separator, even on Windows, so don't use os.path.join # here. + # Ref, for Python 3.10: https://github.com/python/cpython/blob/3.10/Lib/zipfile.py#L355 entry_points_path = "{}.dist-info/entry_points.txt".format(name) # If this file does not exist in the wheel, there are no entry points From 89cb6cd8d6fbceecb0fbaa11f96f8ed6c3312222 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Sat, 27 Nov 2021 16:35:21 +0100 Subject: [PATCH 3/3] Reformat comment and add TODO --- python/pip_install/extract_wheels/lib/wheel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/pip_install/extract_wheels/lib/wheel.py b/python/pip_install/extract_wheels/lib/wheel.py index 5dc6708712..3803fba9ce 100644 --- a/python/pip_install/extract_wheels/lib/wheel.py +++ b/python/pip_install/extract_wheels/lib/wheel.py @@ -57,8 +57,9 @@ def entry_points(self) -> Dict[str, str]: name = "{}-{}".format(metadata.name.replace("-", "_"), metadata.version) # Note that the zipfile module always uses the forward slash as # directory separator, even on Windows, so don't use os.path.join - # here. - # Ref, for Python 3.10: https://github.com/python/cpython/blob/3.10/Lib/zipfile.py#L355 + # here. Reference for Python 3.10: + # https://github.com/python/cpython/blob/3.10/Lib/zipfile.py#L355. + # TODO: use zipfile.Path once 3.8 is our minimum supported version entry_points_path = "{}.dist-info/entry_points.txt".format(name) # If this file does not exist in the wheel, there are no entry points