[GRASS-dev] python2/3 and GRASS build on Arch
Markus Neteler
neteler at osgeo.org
Fri Oct 4 13:45:46 PDT 2013
On 1/4/13, Glynn Clements <glynn at gclements.plus.com> wrote:
>
> 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 am currently trying the opposite on Fedora: enforce to use Python3
in order to check for compiling errors (I was offlist contacted that
GRASS 7 is not Python3 compliant, hence I installed both interpreters
on my machine).
But I get stuck with this:
make -j4 PYTHON=python3
...
python3 -t -3 -m py_compile
/home/neteler/grass70/dist.x86_64-unknown-linux-gnu/etc/python/grass/lib/date.py
Unknown option: -3
usage: python3 [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.
The -t -3 compatibility test checks are coded in include/Make/Python.make
and were added in http://trac.osgeo.org/grass/changeset/56821
"make: -3 parameter added to python to avoid Python 3 incompatibilities"
which is generally fine.
Solution: add a test in
include/Make/Python.make
to check if python2 or python3 are used to only apply the -3 flag in
the former case. Apparently a Python version test could be added
directly in thePython.make file, as suggested here:
http://stackoverflow.com/questions/4933285/how-to-detemine-python-version-in-makefile
Or are there other options?
Markus
More information about the grass-dev
mailing list