[GRASS-dev] python2/3 and GRASS build on Arch

Maciej Sieczka msieczka at sieczka.org
Sun Oct 5 06:44:49 PDT 2014


W dniu 04.01.2013 o 00:13, Glynn Clements pisze:
> Maciej Sieczka wrote:

>>> The python interpreter is accessed via the make variable PYTHON, so
>>> you can use e.g.:
>>>
>>> make PYTHON=python2

>> Still one error crops out - ctypesgen.py has "#!/usr/bin/env python"
>> shebang, which calls Python 3.x on Arch, therefore:
>>
>> Changing that shebang to python2 let the build complete OK. Do you know
>> if there is a workaround which does not involve modyfying the source though?

> Create a directory containing a symlink from "python" to the python2
> executable, than add that directory to the front of the PATH.

I have successfully aplied this approach (symlink `python2' in the root 
of releasebranch_7_0 working copy as `python', add that dir to the front 
of the PATH, export PATH, run `make') until recently I started getting 
the following error during build:

$ pwd
/home/pok/aur/grass70-svn/src/grass70-svn/gui/wxpython/iclass

$ make
make 
/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/docs/html/g.gui.iclass.html
make[1]: Entering directory 
'/home/pok/aur/grass70-svn/src/grass70-svn/gui/wxpython/iclass'
GISRC=/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/demolocation/.grassrc70 
GISBASE=/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu 
PATH="/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/bin:/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/bin:/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/scripts:$PATH" 
PYTHONPATH="/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/etc/python:/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/gui/wxpython:$PYTHONPATH" 
LD_LIBRARY_PATH="/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/bin:/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/scripts:/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/lib:/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/lib:" 
LC_ALL=C 
/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/scripts/g.gui.iclass 
--html-description < /dev/null | grep -v '</body>\|</html>' > 
g.gui.iclass.tmp.html
Traceback (most recent call last):
   File 
"/home/pok/aur/grass70-svn/src/grass70-svn/dist.x86_64-unknown-linux-gnu/scripts/g.gui.iclass", 
line 54, in <module>
     import  wx
ImportError: No module named 'wx'
../../../include/Make/GuiScript.make:36: recipe for target 
'g.gui.iclass.tmp.html' failed
make[1]: *** [g.gui.iclass.tmp.html] Error 1
rm g.gui.iclass.tmp.html
make[1]: Leaving directory 
'/home/pok/aur/grass70-svn/src/grass70-svn/gui/wxpython/iclass'
../../../include/Make/GuiScript.make:22: recipe for target 'guiscript' 
failed
make: *** [guiscript] Error 2

I can `import wx' without issue on `python2' shell, but not on `python3' 
shell, so it seems to me the error above is due to Python 3 being used 
instead of Python 2, in spite of the symlink "hack".

Every other GRASS 7 Python thing builds fine though. Why is iclass build 
trying to use Python 3? How should deal with this, the least intrusive way?

Maciek

-- 
Maciej Sieczka
http://www.sieczka.org



More information about the grass-dev mailing list