pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
6.11k stars 309 forks source link

zipfile will fail if SOURCE_DATE_EPOCH is before 1980 #1605

Closed tuananh closed 4 months ago

tuananh commented 4 months ago

when SOURCE_DATE_EPOCH is set to a value before 1980, zipfile will fail with the following error

 2024/07/09 23:46:03 WARN     zip_info = zipfile.ZipInfo(relative_path, cast(TIME_TUPLE, self.time_tuple))
2024/07/09 23:46:03 WARN                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/07/09 23:46:03 WARN   File "/usr/lib/python3.12/zipfile/__init__.py", line 398, in __init__
2024/07/09 23:46:03 WARN     raise ValueError('ZIP does not support timestamps before 1980')
2024/07/09 23:46:03 WARN ValueError: ZIP does not support timestamps before 1980

https://github.com/pypa/hatch/blob/3adae6c0dfd5c20dfe9bf6bae19b44a696c22a43/backend/src/hatchling/builders/utils.py#L86C1-L93C66

ofek commented 4 months ago

We have no control over that as it is coming from the standard library.

tuananh commented 4 months ago

We have no control over that as it is coming from the standard library.

Got it. Thanks. I will change the epoch to a higher value.