Package: basemap
Version: 1.0.7+dfsg-1
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that basemap could not be built reproducibly.

The attached patches removes extra timestamps from the build system.
Once applied, basemap can be built reproducibly in our current
experimental framework.

 [1]: https://wiki.debian.org/ReproducibleBuilds
diff -urNp basemap-1.0.7+dfsg.old/debian/rules basemap-1.0.7+dfsg/debian/rules
--- basemap-1.0.7+dfsg.old/debian/rules	2012-08-10 18:36:52.000000000 -0300
+++ basemap-1.0.7+dfsg/debian/rules	2015-06-27 13:27:18.548667416 -0300
@@ -3,6 +3,11 @@
 PYVERS := $(shell pyversions -s)
 LIB := $$(python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_platlib")
 
+LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
+BUILD_DATE  = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
+SPHINXOPTS := -D html_last_updated_fmt=\"$(BUILD_DATE)\"
+SPHINXOPTS += -D today=\"$(BUILD_DATE)\"
+
 %:
 	dh $@ --with sphinxdoc
 
@@ -29,7 +34,7 @@ build-indep:
 	# mpl_toolkits namespace
 	ln -s $$(dirname $$(python -c "import mpl_toolkits.axes_grid1 as p; print p.__file__")) $(CURDIR)/$(LIB)/mpl_toolkits/
 	# build doc only for default python version
-	(export MPLCONFIGDIR=. ; cd doc ; PYTHONPATH=$(CURDIR)/$(LIB) BASEMAPDATA=$(CURDIR)/lib/mpl_toolkits/basemap/data/ python make.py html)
+	(export MPLCONFIGDIR=. ; cd doc ; PYTHONPATH=$(CURDIR)/$(LIB) BASEMAPDATA=$(CURDIR)/lib/mpl_toolkits/basemap/data/ python make.py --sphinxopts="$(SPHINXOPTS)" html)
 	# remove hack
 	rm $(CURDIR)/$(LIB)/mpl_toolkits/axes_grid1
 
Description: Modify doc/make.py to add sphinxopts options.
 Allow pass the value of sphinxopts command line option to sphinx-build.
Author: Juan Picca <jumap...@gmail.com>
Last-Update: 2015-06-27
---
--- a/doc/make.py
+++ b/doc/make.py
@@ -5,13 +5,13 @@ import os
 import shutil
 import sys
 
-def html():
-    os.system('sphinx-build -b html -d build/doctrees . build/html')
+def html(opts):
+    os.system('sphinx-build %s -b html -d build/doctrees . build/html' % opts.get('sphinxopts', ''))
 
-def latex():
+def latex(opts):
     if sys.platform != 'win32':
         # LaTeX format.
-        os.system('sphinx-build -b latex -d build/doctrees . build/latex')
+        os.system('sphinx-build %s -b latex -d build/doctrees . build/latex' % opts.get('sphinxopts', ''))
 
         # Produce pdf.
         os.chdir('build/latex')
@@ -27,12 +27,12 @@ def latex():
     else:
         print 'latex build has not been tested on windows'
 
-def clean():
+def clean(opts):
     shutil.rmtree('build')
 
-def all():
-    html()
-    latex()
+def all(opts):
+    html(opts)
+    latex(opts)
 
 
 funcd = {
@@ -44,11 +44,16 @@ funcd = {
 
 
 if len(sys.argv)>1:
+    opts = {}
     for arg in sys.argv[1:]:
+        if arg.startswith('--sphinxopts='):
+            opts['sphinxopts'] = arg.replace('--sphinxopts=', '')
+            continue
+
         func = funcd.get(arg)
         if func is None:
             raise SystemExit('Do not know how to handle %s; valid args are'%(
                     arg, funcd.keys()))
-        func()
+        func(opts)
 else:
-    all()
+    all({})

Reply via email to