1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
From: Dmitry Shachnev <mitya57@debian.org>
Date: Sat, 3 Aug 2024 18:02:02 +0300
Subject: Add support for SOURCE_DATE_EPOCH environment variable
This makes the documentation build reproducibly.
Forwarded: https://github.com/funilrys/PyFunceble/pull/376
---
PyFunceble/downloader/base.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/PyFunceble/downloader/base.py b/PyFunceble/downloader/base.py
index 96ed8f7..c082478 100644
--- a/PyFunceble/downloader/base.py
+++ b/PyFunceble/downloader/base.py
@@ -298,6 +298,10 @@ class DownloaderBase:
"""
current_datetime = datetime.datetime.now(datetime.timezone.utc)
+ if epoch := os.environ.get("SOURCE_DATE_EPOCH"):
+ current_datetime = datetime.datetime.fromtimestamp(
+ float(epoch), datetime.timezone.utc
+ )
self.all_downtimes[self.DOWNTIME_INDEX] = {
"iso": current_datetime.isoformat(),
|