diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2023-03-24 17:45:57 +0000 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2023-05-03 14:10:22 +0100 |
| commit | b538464546150019fb01d8ed4a194bf4f6e56fcc (patch) | |
| tree | 68cf0cd7622e280a335698256713a162f0fecf7e /setuptools | |
| parent | 7d8fba390a72ea98efdfc51c627aa3c96c368678 (diff) | |
| download | python-setuptools-git-b538464546150019fb01d8ed4a194bf4f6e56fcc.tar.gz | |
Mark regular files in wheelbuilder
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/_wheelbuilder.py | 4 | ||||
| -rw-r--r-- | setuptools/tests/test_wheelbuilder.py | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/setuptools/_wheelbuilder.py b/setuptools/_wheelbuilder.py index 26c4b2a9..742dd61a 100644 --- a/setuptools/_wheelbuilder.py +++ b/setuptools/_wheelbuilder.py @@ -125,7 +125,7 @@ class WheelBuilder: the UTF-8 text specified by ``contents``. """ zipinfo = ZipInfo(arcname, self._timestamp) - zipinfo.external_attr = permissions << 16 + zipinfo.external_attr = (permissions | stat.S_IFREG) << 16 zipinfo.compress_type = _COMPRESSION hashsum = hashlib.new(_HASH_ALG) file_size = 0 @@ -141,7 +141,7 @@ class WheelBuilder: def _save_record(self): arcname = f"{self._dist_info}/RECORD" zipinfo = ZipInfo(arcname, self._timestamp) - zipinfo.external_attr = 0o664 << 16 + zipinfo.external_attr = (0o664 | stat.S_IFREG) << 16 zipinfo.compress_type = _COMPRESSION out = self._zip.open(zipinfo, "w") buf = io.TextIOWrapper(out, encoding="utf-8") diff --git a/setuptools/tests/test_wheelbuilder.py b/setuptools/tests/test_wheelbuilder.py index bfe8f84d..47238061 100644 --- a/setuptools/tests/test_wheelbuilder.py +++ b/setuptools/tests/test_wheelbuilder.py @@ -1,6 +1,7 @@ # This test is based on the `test_wheelfile.py` from pypa/wheel, # which was initially distributed under the MIT License: # Copyright (c) 2012 Daniel Holth <dholth@fastmail.fm> and contributors +import stat import sys import textwrap from zipfile import ZipFile, ZIP_DEFLATED @@ -73,9 +74,8 @@ def test_attributes(tmp_path_factory, tmp_path): with ZipFile(wheel_path, "r") as zf: for filename, mode in files: info = zf.getinfo(filename) - assert info.external_attr == (mode | 0o100000) << 16 + assert info.external_attr == (mode | stat.S_IFREG) << 16 assert info.compress_type == ZIP_DEFLATED info = zf.getinfo("test-1.0.dist-info/RECORD") - permissions = (info.external_attr >> 16) & 0o777 - assert permissions == 0o664 + assert info.external_attr == (0o664 | stat.S_IFREG) << 16 |
