diff --git a/examples/wheel/wheel_test.py b/examples/wheel/wheel_test.py index f326af20c6..8200e54cfd 100644 --- a/examples/wheel/wheel_test.py +++ b/examples/wheel/wheel_test.py @@ -238,6 +238,14 @@ def test_custom_package_root_wheel(self): ], ) + record_contents = zf.read( + "examples_custom_package_root-0.0.1.dist-info/RECORD" + ).decode("utf-8") + + # Ensure RECORD files do not have leading forward slashes + for line in record_contents.splitlines(): + self.assertFalse(line.startswith("/")) + def test_custom_package_root_multi_prefix_wheel(self): filename = os.path.join( os.environ["TEST_SRCDIR"], @@ -261,6 +269,14 @@ def test_custom_package_root_multi_prefix_wheel(self): ], ) + record_contents = zf.read( + "example_custom_package_root_multi_prefix-0.0.1.dist-info/RECORD" + ).decode("utf-8") + + # Ensure RECORD files do not have leading forward slashes + for line in record_contents.splitlines(): + self.assertFalse(line.startswith("/")) + def test_custom_package_root_multi_prefix_reverse_order_wheel(self): filename = os.path.join( os.environ["TEST_SRCDIR"], @@ -284,6 +300,14 @@ def test_custom_package_root_multi_prefix_reverse_order_wheel(self): ], ) + record_contents = zf.read( + "example_custom_package_root_multi_prefix_reverse_order-0.0.1.dist-info/RECORD" + ).decode("utf-8") + + # Ensure RECORD files do not have leading forward slashes + for line in record_contents.splitlines(): + self.assertFalse(line.startswith("/")) + def test_python_requires_wheel(self): filename = os.path.join( os.environ["TEST_SRCDIR"], diff --git a/tools/wheelmaker.py b/tools/wheelmaker.py index b5ad346d70..fb8e37b5a9 100644 --- a/tools/wheelmaker.py +++ b/tools/wheelmaker.py @@ -214,7 +214,7 @@ def add_recordfile(self): contents = b"" for filename, digest, size in entries: if sys.version_info[0] > 2 and isinstance(filename, str): - filename = filename.encode("utf-8", "surrogateescape") + filename = filename.lstrip("/").encode("utf-8", "surrogateescape") contents += b"%s,%s,%s\n" % (filename, digest, size) self.add_string(record_path, contents)