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

Maciej Sieczka msieczka at sieczka.org
Thu Jan 3 11:22:25 PST 2013


W dniu 03.01.2013 02:45, Glynn Clements pisze:
> Maciej Sieczka wrote:

>> On Arch GNU/Linux the `python' executable by default links to
>> `python3'. To use Python 2.x, one has to call `python2'
>> explicitely. This requires Archers to tweak
>> include/Make/Platform.make.in and each GRASS python executable to
>> build and use GRASS (e.g. like in
>> https://aur.archlinux.org/packages/gr/grass7-svn/PKGBUILD).
>>
>> Can GRASS make system be changed so that the python executable
>> used during GRASS build and runtime is configurable?

> 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:

$ make PYTHON=python2
<snip>
make[4]: Entering directory
`/home/users/pok/src/builds/releasebranch_6_4/lib/python/ctypes'
(...)
Traceback (most recent call last)
   File "./ctypesgen.py", line 36, in <module>
     import ctypesgencore
   File
"/home/users/pok/src/builds/releasebranch_6_4/lib/python/ctypes/ctypesgencore/__init__.py",
line 52, in <module>
     import processor
ImportError: No module named 'processor'
make[5]: *** [date.py] Error 1
make[5]: Leaving directory
`/home/users/pok/src/builds/releasebranch_6_4/lib/python/ctypes'
make[4]: *** [default] Error 2
make[4]: Leaving directory
`/home/users/pok/src/builds/releasebranch_6_4/lib/python/ctypes'
make[3]: Leaving directory
`/home/users/pok/src/builds/releasebranch_6_4/lib/python'
</snip>

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?

> But in 7.0,

I haven't mentioned I'm bulding releasebranch_6_4 actualy. Anyway, these
problems apply to 7 and 6.5 as well.

> all of the shell scripts have been replaced by Python scripts, with
> the shebang:
>
> #!/usr/bin/env python
>
> The simplest solution for this is probably to add a symlink from
> $GISBASE/bin/python to the appropriate interpreter.

Thanks. I'll try that.

Maciek

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


More information about the grass-dev mailing list