Source: pydoctor
Version: 0.5+bzr616-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: toolchain timestamps
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi,

While working on the "reproducible builds" effort [1], we have noticed
that pydoctor does not generate reproducible output.

The attached patch adds an option to specify a deterministic timestamp.
Once applied, packages using pydoctor will be able to be built
reproducibly
in our current experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
diff --git a/pydoctor/driver.py b/pydoctor/driver.py
index 06c8b13..fbfce19 100644
--- a/pydoctor/driver.py
+++ b/pydoctor/driver.py
@@ -2,7 +2,9 @@
 
 from pydoctor import model, zopeinterface
 from pydoctor.sphinx import SphinxInventory
-import sys, os
+import sys, os, datetime
+
+BUILDTIME_FORMAT = '%Y-%m-%d %H:%M:%S'
 
 def error(msg, *args):
     if args:
@@ -158,6 +160,10 @@ def getparser():
         help=("Generate (unobstrusive) JavaScript to hide some of the "
               "entries in long lists of e.g. subclasses."))
     parser.add_option(
+        '--buildtime', dest='buildtime',
+        help=("Use the specified build time over the current time. "
+              "Format: %s" % BUILDTIME_FORMAT))
+    parser.add_option(
         '--livecheck', action='store_true', dest='livecheck',
         default=False,
         help=("Import and examine the modules too.  XXX not working "
@@ -292,6 +298,13 @@ def main(args):
             else:
                 options.makehtml = False
 
+        if options.buildtime:
+            try:
+                system.buildtime = datetime.datetime.strptime(
+                    options.buildtime, BUILDTIME_FORMAT)
+            except ValueError, e:
+                error(e)
+
         # step 2: add any packages and modules
 
         if args:
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to