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.
This commit is contained in:
Bernhard M. Wiedemann 2018-06-01 07:12:08 +02:00 committed by Valentin Lorentz
parent 01e4427057
commit cd8ad1edb6

View File

@ -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