File tree 3 files changed +21
-0
lines changed
3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ Release Notes
10
10
values) is now delegated to ``setuptools>=57.0.0 `` (#466).
11
11
The package dependencies were updated to reflect this change.
12
12
- Fixed potential DoS attack via the ``WHEEL_INFO_RE `` regular expression
13
+ - Fixed ``ValueError: ZIP does not support timestamps before 1980 `` when using
14
+ ``SOURCE_DATE_EPOCH=0 `` or when on-disk timestamps are earlier than 1980-01-01. Such
15
+ timestamps are now changed to the minimum value before packaging.
13
16
14
17
**0.37.1 (2021-12-22) **
15
18
Original file line number Diff line number Diff line change 20
20
-(?P<pyver>[^-]+?)-(?P<abi>[^-]+?)-(?P<plat>[^.]+?)\.whl$""" ,
21
21
re .VERBOSE ,
22
22
)
23
+ MINIMUM_TIMESTAMP = 315532800 # 1980-01-01 00:00:00 UTC
23
24
24
25
25
26
def get_zipinfo_datetime (timestamp = None ):
26
27
# Some applications need reproducible .whl files, but they can't do this without
27
28
# forcing the timestamp of the individual ZipInfo objects. See issue #143.
28
29
timestamp = int (os .environ .get ("SOURCE_DATE_EPOCH" , timestamp or time .time ()))
30
+ timestamp = max (timestamp , MINIMUM_TIMESTAMP )
29
31
return time .gmtime (timestamp )[0 :6 ]
30
32
31
33
Original file line number Diff line number Diff line change @@ -202,3 +202,19 @@ def test_wheelfile_line_endings(wheel_paths):
202
202
wheelfile = next (fn for fn in wf .filelist if fn .filename .endswith ("WHEEL" ))
203
203
wheelfile_contents = wf .read (wheelfile )
204
204
assert b"\r " not in wheelfile_contents
205
+
206
+
207
+ def test_unix_epoch_timestamps (dummy_dist , monkeypatch , tmpdir ):
208
+ monkeypatch .setenv ("SOURCE_DATE_EPOCH" , "0" )
209
+ monkeypatch .chdir (dummy_dist )
210
+ subprocess .check_call (
211
+ [
212
+ sys .executable ,
213
+ "setup.py" ,
214
+ "bdist_wheel" ,
215
+ "-b" ,
216
+ str (tmpdir ),
217
+ "--universal" ,
218
+ "--build-number=2" ,
219
+ ]
220
+ )
You can’t perform that action at this time.
0 commit comments