From cd8ad1edb6b78ad1dbdf73a0706a1fb9d20aa3c9 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Fri, 1 Jun 2018 07:12:08 +0200 Subject: [PATCH] Allow to override build date in order to make builds reproducible. See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. --- setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 09bf9d00b..0df696cc6 100644 --- a/setup.py +++ b/setup.py @@ -62,8 +62,9 @@ except: if os.path.isfile(VERSION_FILE): from src.version import version else: - from time import gmtime, strftime - version = 'installed on ' + strftime("%Y-%m-%dT%H-%M-%S", gmtime()) + from time import gmtime, strftime, time + t = int(os.environ.get('SOURCE_DATE_EPOCH', time())) + version = 'installed on ' + strftime("%Y-%m-%dT%H-%M-%S", gmtime(t)) try: os.unlink(VERSION_FILE) except OSError: # Does not exist