Commit 25156790 by Sébastien Eustace

Fix permissions of the dist-info files

parent ade97ab7
...@@ -277,6 +277,7 @@ class WheelBuilder(Builder): ...@@ -277,6 +277,7 @@ class WheelBuilder(Builder):
# give you the exact same result. # give you the exact same result.
date_time = (2016, 1, 1, 0, 0, 0) date_time = (2016, 1, 1, 0, 0, 0)
zi = zipfile.ZipInfo(rel_path, date_time) zi = zipfile.ZipInfo(rel_path, date_time)
zi.external_attr = (0o644 & 0xFFFF) << 16 # Unix attributes
b = sio.getvalue().encode("utf-8") b = sio.getvalue().encode("utf-8")
hashsum = hashlib.sha256(b) hashsum = hashlib.sha256(b)
hash_digest = urlsafe_b64encode(hashsum.digest()).decode("ascii").rstrip("=") hash_digest = urlsafe_b64encode(hashsum.digest()).decode("ascii").rstrip("=")
......
...@@ -128,3 +128,26 @@ def test_package_with_include(mocker): ...@@ -128,3 +128,26 @@ def test_package_with_include(mocker):
assert "my_module.py" in names assert "my_module.py" in names
assert "notes.txt" in names assert "notes.txt" in names
assert "package_with_include/__init__.py" in names assert "package_with_include/__init__.py" in names
def test_dist_info_file_permissions():
module_path = fixtures_dir / "complete"
WheelBuilder.make(Poetry.create(str(module_path)), NullEnv(), NullIO())
whl = module_path / "dist" / "my_package-1.2.3-py3-none-any.whl"
with zipfile.ZipFile(str(whl)) as z:
assert (
z.getinfo("my_package-1.2.3.dist-info/WHEEL").external_attr == 0o644 << 16
)
assert (
z.getinfo("my_package-1.2.3.dist-info/METADATA").external_attr
== 0o644 << 16
)
assert (
z.getinfo("my_package-1.2.3.dist-info/RECORD").external_attr == 0o644 << 16
)
assert (
z.getinfo("my_package-1.2.3.dist-info/entry_points.txt").external_attr
== 0o644 << 16
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment