Source: sphinx
Version: 1.3.6-2
Severity: wishlist
Tags: patch upstream
User: [email protected]
Usertags: toolchain
X-Debbugs-Cc: [email protected]
Control: forwarded -1 https://github.com/sphinx-doc/sphinx/pull/2480
Dear Maintainer,
While working on the “reproducible builds” effort [1], we have noticed
that the documentation generated by sphinx can include the memory
address of some python objects that are used at build time. See for
example, in file
/usr/share/doc/python-kombu-doc/html/reference/kombu.transport.qpid.html
from package python-kombu-doc_3.0.35-1.1 :
Transport.Connection.Channel.codecs = {'base64':
<kombu.transport.virtual.Base64 object at 0x7f10fff1a590>}
This memory address is irrelevant in the documentation, and prevents the
package building to be reproducible.
The attached patch strips these memory addresses, leading to better
reproducibility.
Regards,
Alexis Bienvenüe.
[1] https://wiki.debian.org/ReproducibleBuilds
diff -Nru sphinx-1.3.6/debian/changelog sphinx-1.3.6/debian/changelog
--- sphinx-1.3.6/debian/changelog 2016-03-03 18:22:21.000000000 +0100
+++ sphinx-1.3.6/debian/changelog 2016-04-22 00:37:33.000000000 +0200
@@ -1,3 +1,9 @@
+sphinx (1.3.6-3) unstable; urgency=medium
+
+ * Strips memory addresses from python documentation
+
+ -- Alexis Bienvenüe <[email protected]> Fri, 22 Apr 2016 00:37:33 +0200
+
sphinx (1.3.6-2) unstable; urgency=medium
* Use implementation of jstest from Iain Lane in hope it succeeds on
diff -Nru sphinx-1.3.6/debian/patches/remove_memaddress.patch sphinx-1.3.6/debian/patches/remove_memaddress.patch
--- sphinx-1.3.6/debian/patches/remove_memaddress.patch 1970-01-01 01:00:00.000000000 +0100
+++ sphinx-1.3.6/debian/patches/remove_memaddress.patch 2016-04-22 00:36:39.000000000 +0200
@@ -0,0 +1,36 @@
+Description: Removes memory addresses from generated documentation
+ Some modules have eg. functions in some default arguments values, so
+ that sphinx generates signatures with some memory addresses in it.
+ This strips thes addresses.
+Author: Alexis Bienvenüe <[email protected]>
+
+Index: sphinx-1.3.6/sphinx/domains/python.py
+===================================================================
+--- sphinx-1.3.6.orig/sphinx/domains/python.py
++++ sphinx-1.3.6/sphinx/domains/python.py
+@@ -34,6 +34,8 @@ py_sig_re = re.compile(
+ )? $ # and nothing more
+ ''', re.VERBOSE)
+
++# RE for memory address in variable description
++py_memaddr_re = re.compile(r' at 0x[0-9a-f]{4,}(?=>)')
+
+ def _pseudo_parse_arglist(signode, arglist):
+ """"Parse" a list of arguments separated by commas.
+@@ -62,6 +64,7 @@ def _pseudo_parse_arglist(signode, argli
+ ends_open += 1
+ argument = argument[:-1].strip()
+ if argument:
++ argument = py_memaddr_re.sub('',argument)
+ stack[-1] += addnodes.desc_parameter(argument, argument)
+ while ends_open:
+ stack.append(addnodes.desc_optional())
+@@ -220,6 +223,8 @@ class PyObject(ObjectDescription):
+ if retann:
+ signode += addnodes.desc_returns(retann, retann)
+ if anno:
++ if anno[0] == '=':
++ anno = py_memaddr_re.sub('',anno)
+ signode += addnodes.desc_annotation(' ' + anno, ' ' + anno)
+ return fullname, name_prefix
+
diff -Nru sphinx-1.3.6/debian/patches/series sphinx-1.3.6/debian/patches/series
--- sphinx-1.3.6/debian/patches/series 2016-03-03 18:22:21.000000000 +0100
+++ sphinx-1.3.6/debian/patches/series 2016-04-22 00:34:39.000000000 +0200
@@ -7,3 +7,4 @@
reproducible_inventory.diff
reproducible_js_locale.diff
reproducible_searchindex.diff
+remove_memaddress.patch
_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team