[GRASS-dev] sphinx python documentation

Pietro peter.zamb at gmail.com
Fri Jun 13 04:59:50 PDT 2014


Hi Luca,

On Fri, Jun 13, 2014 at 11:59 AM, Luca Delucchi <lucadeluge at gmail.com> wrote:
> On 31 May 2014 02:03, Vaclav Petras <wenzeslaus at gmail.com> wrote:
>>
>
>> This would be really great. For Python and GUI I'm always looking to source
>> code rather than Doxygen but I hope that with Sphinx it will be a start of a
>> new documentation which I will actually use.
>>
>
> I everybody,
>
> In r60817 I committed Sphinx support for wxgui API doc. To compile the
> sphinx documentation you need to launch "make sphinxdoc" and it create
> a new directory wxgui in dist/docs/html/.

Hi Luca,

thanks for the work!

I'm trying to build the docs with: make sphinxdoc , I think the
problem is that on my system the default python interpreter is
python3, so even if I'm launching the make command from inside a
virtualenv using python2 I got this import error:

{{{
$ make sphinxdoc
make -C ./gui/wxpython/docs/wxgui_sphinx/ wxguiclean
make[1]: Entering directory
'/home/pietro/docdat/src/gis/grass71/gui/wxpython/docs/wxgui_sphinx'
rm -rf _build/*
rm -f _templates/layout.html
make[1]: Leaving directory
'/home/pietro/docdat/src/gis/grass71/gui/wxpython/docs/wxgui_sphinx'
make -C ./gui/wxpython/docs/wxgui_sphinx/ wxguiapidoc
make[1]: Entering directory
'/home/pietro/docdat/src/gis/grass71/gui/wxpython/docs/wxgui_sphinx'
GISRC=/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/demolocation/.grassrc71
GISBASE=/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu
PATH="/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/bin:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/bin:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/scripts:$PATH"
PYTHONPATH="/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/etc/python:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/gui/wxpython:$PYTHONPATH"
LD_LIBRARY_PATH="/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/bin:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/scripts:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib::/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib"
LC_ALL=C  sphinx-apidoc -T -f -o . ../../
Creating file ./gis_set.rst.
Creating file ./gis_set_error.rst.
Creating file ./menustrings.rst.
Creating file ./wxgui.rst.
Creating file ./animation.rst.
Creating file ./core.rst.
Creating file ./dbmgr.rst.
Creating file ./gcp.rst.
Creating file ./gmodeler.rst.
Creating file ./gui_core.rst.
Creating file ./iclass.rst.
Creating file ./icons.rst.
Creating file ./iscatt.rst.
Creating file ./lmgr.rst.
Creating file ./location_wizard.rst.
Creating file ./mapdisp.rst.
Creating file ./mapswipe.rst.
Creating file ./mapwin.rst.
Creating file ./modules.rst.
Creating file ./nviz.rst.
Creating file ./psmap.rst.
Creating file ./rlisetup.rst.
Creating file ./timeline.rst.
Creating file ./vdigit.rst.
Creating file ./vnet.rst.
Creating file ./web_services.rst.
Creating file ./wxplot.rst.
make[1]: Leaving directory
'/home/pietro/docdat/src/gis/grass71/gui/wxpython/docs/wxgui_sphinx'
make -C ./gui/wxpython/docs/wxgui_sphinx/ wxguihtml
make[1]: Entering directory
'/home/pietro/docdat/src/gis/grass71/gui/wxpython/docs/wxgui_sphinx'
GISRC=/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/demolocation/.grassrc71
GISBASE=/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu
PATH="/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/bin:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/bin:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/scripts:$PATH"
PYTHONPATH="/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/etc/python:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/gui/wxpython:$PYTHONPATH"
LD_LIBRARY_PATH="/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/bin:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/scripts:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib::/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib:/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/lib"
LC_ALL=C sphinx-build -b html -d _build/doctrees   .
/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/docs/html/wxgui
Running Sphinx v1.2.2

Exception occurred:
  File "/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/__init__.py",
line 2, in <module>
    from db     import *
ImportError: No module named 'db'
The full traceback has been saved in /tmp/sphinx-err-xgw_pix0.log, if
you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error
message can be provided next time.
A bug report can be filed in the tracker at
<https://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
Makefile:61: recipe for target 'wxguihtml' failed
make[1]: *** [wxguihtml] Error 1
make[1]: Leaving directory
'/home/pietro/docdat/src/gis/grass71/gui/wxpython/docs/wxgui_sphinx'
include/Make/Sphinx.make:27: recipe for target 'sphinxdoc' failed
make: *** [sphinxdoc] Error 2
}}}

looking at the log file it is clear that I'm using python3 instead of python 2:

{{{
2(py2)ztl ∴ cat /tmp/sphinx-err-xgw_pix0.log
# Sphinx version: 1.2.2
# Python version: 3.4.1
# Docutils version: 0.11 release
# Jinja2 version: 2.7.3
# Loaded extensions:
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/sphinx/cmdline.py", line 253, in main
    warningiserror, tags, verbosity, parallel)
  File "/usr/lib/python3.4/site-packages/sphinx/application.py", line
107, in __init__
    confoverrides or {}, self.tags)
  File "/usr/lib/python3.4/site-packages/sphinx/config.py", line 229,
in __init__
    execfile_(filename, config)
  File "/usr/lib/python3.4/site-packages/sphinx/util/pycompat.py",
line 105, in execfile_
    exec(code, _globals)
  File "conf.py", line 27, in <module>
    from grass.script import core
  File "/home/pietro/docdat/src/gis/grass71/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/__init__.py",
line 2, in <module>
    from db     import *
ImportError: No module named 'db'
}}}


I've tried also with:

{{{
$ export PYTHON=/usr/bin/python2
}}}

and then make sphinxdoc, but still it is using the wrong interpreter,
it seems like the make is ignoring my local environment variables,
someone has an idea on how I could try to solve this?

Pietro


More information about the grass-dev mailing list