Package: python-reportlab
Version: 3.3.0-1
Severity: normal
Tags: patch
Usertags: toolchain timestamps

While working on the “reproducible builds” effort [1], we have noticed that
reportlab embeds current timestamp in the generated PDF. This behavior make
packages whose documentation is generated with reportlab unreproducible.

The attached patch fixes this behavior honoring the SOURCE_DATE_EPOCH [2]
environment variable.

Description: Honour SOURCE_DATE_EPOCH environment variable
 If the SOURCE_DATE_EPOCH environment variable is set, reportlab will use
 it instead of the current timestamp.
 python-reportlab (3.3.0-1.0~reproducible1) UNRELEASED; urgency=medium
   * Honour SOURCE_DATE_EPOCH, to generate PDFs reproducibly
Author: boyska <>

The information above should follow the Patch Tagging Guidelines, please
checkout to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- python-reportlab-3.3.0.orig/src/reportlab/pdfbase/
+++ python-reportlab-3.3.0/src/reportlab/pdfbase/
@@ -1730,8 +1730,12 @@ _NOWT=None
 def _getTimeStamp():
     global _NOWT
     if not _NOWT:
-        import time
-        _NOWT = time.time()
+        import os
+        if 'SOURCE_DATE_EPOCH' in os.environ:
+            _NOWT = float(os.environ['SOURCE_DATE_EPOCH'])
+        else:
+            import time
+            _NOWT = time.time()
     return _NOWT
 class PDFDate(PDFObject):
Reproducible-builds mailing list

Reply via email to