File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ Release Notes
1010 values) is now delegated to ``setuptools>=57.0.0 `` (#466).
1111 The package dependencies were updated to reflect this change.
1212- 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.
1316
1417**0.37.1 (2021-12-22) **
1518
Original file line number Diff line number Diff line change 2020 -(?P<pyver>[^-]+?)-(?P<abi>[^-]+?)-(?P<plat>[^.]+?)\.whl$""" ,
2121 re .VERBOSE ,
2222)
23+ MINIMUM_TIMESTAMP = 315532800 # 1980-01-01 00:00:00 UTC
2324
2425
2526def get_zipinfo_datetime (timestamp = None ):
2627 # Some applications need reproducible .whl files, but they can't do this without
2728 # forcing the timestamp of the individual ZipInfo objects. See issue #143.
2829 timestamp = int (os .environ .get ("SOURCE_DATE_EPOCH" , timestamp or time .time ()))
30+ timestamp = max (timestamp , MINIMUM_TIMESTAMP )
2931 return time .gmtime (timestamp )[0 :6 ]
3032
3133
Original file line number Diff line number Diff line change @@ -202,3 +202,19 @@ def test_wheelfile_line_endings(wheel_paths):
202202 wheelfile = next (fn for fn in wf .filelist if fn .filename .endswith ("WHEEL" ))
203203 wheelfile_contents = wf .read (wheelfile )
204204 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