waf and Python 3.7

Christian Mauderer list at c-mauderer.de
Sat Dec 22 19:22:45 UTC 2018


>> First of all: I tried a pdf build. But I receive the same error
>> on a html build.
> 
> I do not see this error.
> 
>> See attached log for the complete output with python2
>> on the current HEAD (75f24638b3f).
> 
> I cannot see what is wrong. There is a waf configure option to add verbose
> levels to `sphinx-build`. I suggest you add '-v -v' to see if it can provide
> some insight to the problem.
> 
> The waf script glob's the directory. Is there something in your tree which is
> getting picked up?

Hello Chris,

I found my problem: There is a conf.py in my /usr/bin. A package called
"glusterfs" (not sure when I used or installed that) put it there.

The user/conf.py (like all other <manual>/conf.py) that is used for the
sphinx configuration starts like follows:

    import sys, os
    sys.path.append(os.path.abspath('../common/'))

    from conf import *

My sys.path looks like follows:

    ['/usr/bin', '/usr/lib/python37.zip', '/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload', '/usr/lib/python3.7/site-packages',
'/usr/lib/python3.7/site-packages/linkgrammar']

With the append, the conf.py in /usr/bin is still the one used first.
Theoretically it is possible to use the following instead of the
sys.path.append:

    sys.path.insert(0, os.path.abspath('../common/'))

But that command is not really good either. It would hurt a documented
python behaviour. See https://stackoverflow.com/a/10097543/2229658 and
https://docs.python.org/3/library/sys.html#sys.path. Basically path[0]
should be the path of the script. In this case the script is the
sphinx-builder which is executed from /usr/bin and which calls conf.py
via a exec statement.

Although I have to say that it is really a stupid idea of the glusterfs
packet to install a conf.py into /urs/bin, I don't think that is good
for our build to include that file. There could be a packet called conf
anywhere on a system. It's not a that uncommon name. I did some tests
with relative imports but these failed. Any good idea how a clean and
compatible solution could look like for that problem?

Best regards

Christian




More information about the devel mailing list