diff --git a/0001-Fixed-pre-1980-file-timestamps-raising-ValueError.patch b/0001-Fixed-pre-1980-file-timestamps-raising-ValueError.patch new file mode 100644 index 0000000000000000000000000000000000000000..b3bb8f69bfa6f8f3ac5e18b6efc9f8cd0e3a0d40 --- /dev/null +++ b/0001-Fixed-pre-1980-file-timestamps-raising-ValueError.patch @@ -0,0 +1,59 @@ +From ef6b4027e74a8271d89ee44b38e43e273882ef77 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= +Date: Thu, 20 Oct 2022 17:31:51 +0300 +Subject: [PATCH] Fixed pre-1980 file timestamps raising ValueError + +Reference:https://github.com/pypa/wheel/commit/ef6b4027e74a8271d89ee44b38e43e273882ef77 + +Fixes #418. +--- + src/wheel/wheelfile.py | 2 ++ + tests/test_bdist_wheel.py | 16 ++++++++++++++++ + 2 files changed, 18 insertions(+) + +diff --git a/src/wheel/wheelfile.py b/src/wheel/wheelfile.py +index b985774..f55fc73 100644 +--- a/src/wheel/wheelfile.py ++++ b/src/wheel/wheelfile.py +@@ -30,12 +30,14 @@ WHEEL_INFO_RE = re.compile( + r"""^(?P(?P[^\s-]+?)-(?P[^\s-]+?))(-(?P\d[^\s-]*))? + -(?P[^\s-]+?)-(?P[^\s-]+?)-(?P\S+)\.whl$""", + re.VERBOSE) ++MINIMUM_TIMESTAMP = 315532800 # 1980-01-01 00:00:00 UTC + + + def get_zipinfo_datetime(timestamp=None): + # Some applications need reproducible .whl files, but they can't do this without forcing + # the timestamp of the individual ZipInfo objects. See issue #143. + timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', timestamp or time.time())) ++ timestamp = max(timestamp, MINIMUM_TIMESTAMP) + return time.gmtime(timestamp)[0:6] + + +diff --git a/tests/test_bdist_wheel.py b/tests/test_bdist_wheel.py +index 5ed9a41..2a4d777 100644 +--- a/tests/test_bdist_wheel.py ++++ b/tests/test_bdist_wheel.py +@@ -154,3 +154,19 @@ def test_wheelfile_line_endings(wheel_paths): + wheelfile = next(fn for fn in wf.filelist if fn.filename.endswith('WHEEL')) + wheelfile_contents = wf.read(wheelfile) + assert b'\r' not in wheelfile_contents ++ ++ ++def test_unix_epoch_timestamps(dummy_dist, monkeypatch, tmp_path): ++ monkeypatch.setenv("SOURCE_DATE_EPOCH", "0") ++ monkeypatch.chdir(dummy_dist) ++ subprocess.check_call( ++ [ ++ sys.executable, ++ "setup.py", ++ "bdist_wheel", ++ "-b", ++ str(tmp_path), ++ "--universal", ++ "--build-number=2", ++ ] ++ ) +-- +2.33.0 + diff --git a/python-wheel.spec b/python-wheel.spec index 8b65cffbd952f1686a85d0096e14710c7b19e4ee..a2b2d261f97bd18304af09688559c1ea3e08869a 100644 --- a/python-wheel.spec +++ b/python-wheel.spec @@ -1,7 +1,7 @@ %bcond_with bootstrap Name: python-wheel Version: 0.37.0 -Release: 7 +Release: 8 Epoch: 1 Summary: Built-package format for Python License: MIT @@ -13,6 +13,7 @@ Patch01: 0001-Fixed-wheel-pack-duplicating-WHEEL-contents-on-build.patch Patch02: 0001-Support-unpacking-wheels-that-contain-files-with-com.patch Patch03: CVE-2022-40898.patch Patch04: backport-Fixed-parsing-of-wheel-file-names-with-multiple-platform-tags.patch +Patch05: 0001-Fixed-pre-1980-file-timestamps-raising-ValueError.patch %description A built-package format for Python. @@ -84,6 +85,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3 -v --ignore build %endif %changelog +* Mon Dec 25 2023 yuxiating - 1:0.37.0-8 +- Fixed pre-1980 file timestamps raising ValueError + * Tue Dec 19 2023 shixuantong - 1:0.37.0-7 - Fixed parsing of wheel file names with multiple platform tags