!64 Fixed pre-1980 file timestamps raising ValueError
From: @yuxiating2021 Reviewed-by: @Charlie_li Signed-off-by: @Charlie_li
This commit is contained in:
commit
ecaa880789
59
0001-Fixed-pre-1980-file-timestamps-raising-ValueError.patch
Normal file
59
0001-Fixed-pre-1980-file-timestamps-raising-ValueError.patch
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
From ef6b4027e74a8271d89ee44b38e43e273882ef77 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= <alex.gronholm@nextday.fi>
|
||||||
|
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<namever>(?P<name>[^\s-]+?)-(?P<ver>[^\s-]+?))(-(?P<build>\d[^\s-]*))?
|
||||||
|
-(?P<pyver>[^\s-]+?)-(?P<abi>[^\s-]+?)-(?P<plat>\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
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
%bcond_with bootstrap
|
%bcond_with bootstrap
|
||||||
Name: python-wheel
|
Name: python-wheel
|
||||||
Version: 0.37.0
|
Version: 0.37.0
|
||||||
Release: 7
|
Release: 8
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Summary: Built-package format for Python
|
Summary: Built-package format for Python
|
||||||
License: MIT
|
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
|
Patch02: 0001-Support-unpacking-wheels-that-contain-files-with-com.patch
|
||||||
Patch03: CVE-2022-40898.patch
|
Patch03: CVE-2022-40898.patch
|
||||||
Patch04: backport-Fixed-parsing-of-wheel-file-names-with-multiple-platform-tags.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
|
%description
|
||||||
A built-package format for Python.
|
A built-package format for Python.
|
||||||
@ -84,6 +85,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-3 -v --ignore build
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Dec 25 2023 yuxiating <yuxiating@xfusion.com> - 1:0.37.0-8
|
||||||
|
- Fixed pre-1980 file timestamps raising ValueError
|
||||||
|
|
||||||
* Tue Dec 19 2023 shixuantong <shixuantong1@huawei.com> - 1:0.37.0-7
|
* Tue Dec 19 2023 shixuantong <shixuantong1@huawei.com> - 1:0.37.0-7
|
||||||
- Fixed parsing of wheel file names with multiple platform tags
|
- Fixed parsing of wheel file names with multiple platform tags
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user