[Python-modules-team] Bug#860218: templayer: please make the build reproducible
Chris Lamb
lamby at debian.org
Wed Apr 12 21:37:35 UTC 2017
Source: templayer
Version: 1.5.1-3
Severity: wishlist
Tags: patch
User: reproducible-builds at lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-bugs at lists.alioth.debian.org
Hi,
Whilst working on the Reproducible Builds effort [0], we noticed
that templayer could not be built reproducibly.
Patch attached.
[0] https://reproducible-builds.org/
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` lamby at debian.org / chris-lamb.co.uk
`-
-------------- next part --------------
--- a/docgen_tutorial.py 2017-04-12 22:16:48.315687328 +0100
--- b/docgen_tutorial.py 2017-04-12 22:35:44.818256044 +0100
@@ -30,7 +30,9 @@
from __future__ import nested_scopes
+import datetime
import sys
+import time
import os
import templayer
@@ -75,6 +77,11 @@
</html>
"""
+try:
+ date = datetime.datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH'])).strftime('%a %b %d %H:%M:%S %Y')
+except KeyError:
+ date = time.asctime()
+
examples["lawn2"] = ["example_lawn2"]
def example_lawn2():
import templayer
@@ -118,7 +125,7 @@
tmpl = templayer.HTMLTemplate("lawn3.html")
file_writer = tmpl.start_file()
file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
file_writer.close()
template["lawn4"] = """
@@ -151,7 +158,7 @@
tmpl = templayer.HTMLTemplate("lawn4.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
main_layer.write_layer('report', day="Sunday", happenings=[
"We've got a groundhog. I will have to stay alert.",
"I lost half a tomato plant to that furry guy."])
@@ -175,7 +182,7 @@
tmpl = templayer.HTMLTemplate("lawn4.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
for d, h in reports:
main_layer.write_layer('report', day=d, happenings=h)
file_writer.close()
@@ -196,7 +203,7 @@
tmpl = templayer.HTMLTemplate("lawn4.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
for d, h in reports:
main_layer.write_layer('report', day=d, happenings=h)
file_writer.close()
@@ -240,7 +247,7 @@
tmpl = templayer.HTMLTemplate("lawn5.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
for d, h in reports:
happening_list = []
for w in h:
@@ -288,7 +295,7 @@
tmpl = templayer.HTMLTemplate("lawn6.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
for d, h in reports:
report_layer = main_layer.open_layer('report', day=d)
for happening in h:
@@ -311,7 +318,7 @@
tmpl = templayer.HTMLTemplate("lawn6.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
for d, h in reports:
report_layer = main_layer.open_layer('report', day=d)
for happening in h:
@@ -335,7 +342,7 @@
tmpl = templayer.HTMLTemplate("lawn6.html")
file_writer = tmpl.start_file()
main_layer = file_writer.open(title="Gordon's Lawn Happenings",
- date=time.asctime())
+ date=date)
for d, h in reports:
report_layer = main_layer.open_layer('report', day=d)
for happening in h:
More information about the Python-modules-team
mailing list