Source: sphinx
Version: 5.3.0-2
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: buildpath
X-Debbugs-Cc: [email protected]

Hi,

Whilst working on the Reproducible Builds effort [0] we noticed that
sphinx could not be built reproducibly.

This is because a default argument for a method uses the path in
which that method is implemented (ie. it uses Python's __file__)
and then that (non-deterministic) default argument is included in
Sphinx's documentation. 

Patch attached that uses the typical; "fn(arg1=None) // if arg1 is
None: arg1=defaultval" pattern to avoid this.

 [0] https://reproducible-builds.org/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
--- a/debian/patches/reproducible_build.diff    1970-01-01 01:00:00.000000000 
+0100
--- b/debian/patches/reproducible_build.diff    2022-12-09 10:51:24.160260646 
+0000
@@ -0,0 +1,24 @@
+Description: Make the build reproducible
+Author: Chris Lamb <[email protected]>
+Last-Update: 2022-12-09
+
+--- sphinx-5.3.0.orig/sphinx/locale/__init__.py
++++ sphinx-5.3.0/sphinx/locale/__init__.py
+@@ -163,13 +163,16 @@ _LOCALE_DIR = path.abspath(path.dirname(
+ 
+ 
+ def init_console(
+-    locale_dir: str = _LOCALE_DIR,
++    locale_dir: Optional[str] = None,
+     catalog: str = 'sphinx',
+ ) -> Tuple[NullTranslations, bool]:
+     """Initialize locale for console.
+ 
+     .. versionadded:: 1.8
+     """
++    if locale_dir is None:
++        locale_dir = _LOCALE_DIR
++
+     try:
+         # encoding is ignored
+         language, _ = locale.getlocale(locale.LC_MESSAGES)
--- a/debian/patches/series     2022-12-09 10:05:26.391272450 +0000
--- b/debian/patches/series     2022-12-09 10:51:22.984253932 +0000
@@ -9,3 +9,4 @@
 intersphinx_local.diff
 support_old_search_indexes.diff
 highlight_search_terms.diff
+reproducible_build.diff

Reply via email to