Source: python-pyxs
Version: 0.4.2~git20190115.97f14313-2
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: buildpath
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0] I noticed that
python-pyxs could not be built reproducibly.

This is because the linkcode Sphinx extension and linkcode_resolve get
confused and try to link to the documentation to the @contextlib.contextmanager
decorator, and then uses relpath... All this results in links differing
depending on the number of directory components in the absolute build path:

  
href="https://github.com/selectel/pyxs/tree/0.4.2-dev/pyxs/../../../../usr/lib/python3.8/contextlib.py#L25-L33

vs.

  
href="https://github.com/selectel/pyxs/tree/0.4.2-dev/pyxs/../../../../../usr/lib/python3.8/contextlib.py#L25-L33";

As these links are broken anyway, I've attached a patch that will simply
hide them if we know they will be wrong. I think the right fix would be
to resolve the location of the exact function "underneath" the decorator.

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


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
--- a/docs/conf.py      2020-07-29 11:09:24.036630132 +0100
--- b/docs/conf.py      2020-07-29 11:45:54.186574021 +0100
@@ -119,6 +119,8 @@
         import pyxs
         fn = inspect.getsourcefile(obj)
         fn = os.path.relpath(fn, os.path.dirname(pyxs.__file__))
+        if fn.startswith(".."):
+            return None
         source, lineno = inspect.getsourcelines(obj)
         return fn, lineno, lineno + len(source) - 1
 

Reply via email to