Re: [GRASS-dev] forcing a Python version/install when compiling GRASS

2015-02-20 Thread Glynn Clements

Yann Chemin wrote:

> I would like to use a different version of Python from the default install in 
> the PC,
> is there a way to force it in the configure script?

No.

You can control the interpreter used for building by overriding the
PYTHON make variable, e.g.

make PYTHON=/path/to/python ...

For controlling the interpreter used at run time:

On Windows, Python scripts are invoked via %GRASS_PYTHON%, so changing
that environment variable will change the interpreter.

On Unix, GRASS_PYTHON is only used for components which use wxPython,
e.g. wxGUI or the parameter dialogs which are displayed when modules
are run without arguments.

Scripts rely upon the "#!/usr/bin/env python" line. You can control
the interpreter used by scripts by creating a directory containing a
symlink named "python" which refers to your preferred version of the
interpreter, and placing that directory at the front of $PATH.

-- 
Glynn Clements 
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] forcing a Python version/install when compiling GRASS

2015-02-20 Thread Vaclav Petras
On Fri, Feb 20, 2015 at 9:26 AM, Markus Neteler  wrote:

> On Fri, Feb 20, 2015 at 2:51 PM, Vaclav Petras 
> wrote:
> >
> > On Fri, Feb 20, 2015 at 8:25 AM, Markus Neteler 
> wrote:
> >>
> >> [neteler@pgis_north ]$ alias python=python3.4
> >>
> >> [neteler@pgis_north ]$ python --version
> >> Python 3.4.1
> >
> > I thought alias works just for command line but the processes, e.g.
> scripts,
> > does not get them.
>
> I refer to this:

$ echo "echo Hello." > test.sh
$ chmod u+x test.sh
$ alias echo='echo "MESSAGE: "'
$ echo Hello
MESSAGE:  Hello
$ ./test.sh
Hello.



> Combined attempt:
>
> [neteler@pgis_north ]$ alias python=python3.4
> [neteler@pgis_north ]$ export GRASS_PYTHON=python3.4
> [neteler@pgis_north ]$ grass71
> Cleaning up temporary files...
> Starting GRASS GIS...
> ...
>
> GRASS 7.1.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHON
> python3.4
>
>
> GRASS 7.1.svn (nc_spm_08_grass7):~ > v.rast.stats
>   File
> "/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/forms.py",
> line 2375
> raise gcmd.GException, _("Unable to parse command '%s'") % '
> '.join(cmd)
>  ^
> SyntaxError: invalid syntax
>
> Did you refer to this problem, Vaclav?
>
> No, but I guess that especially GUI is not Python 3 ready as well as
wxPython.

Vaclav


> Markus
>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] forcing a Python version/install when compiling GRASS

2015-02-20 Thread Markus Neteler
On Fri, Feb 20, 2015 at 2:51 PM, Vaclav Petras  wrote:
>
> On Fri, Feb 20, 2015 at 8:25 AM, Markus Neteler  wrote:
>>
>> [neteler@pgis_north ]$ alias python=python3.4
>>
>> [neteler@pgis_north ]$ python --version
>> Python 3.4.1
>
> I thought alias works just for command line but the processes, e.g. scripts,
> does not get them.

Combined attempt:

[neteler@pgis_north ]$ alias python=python3.4
[neteler@pgis_north ]$ export GRASS_PYTHON=python3.4
[neteler@pgis_north ]$ grass71
Cleaning up temporary files...
Starting GRASS GIS...
...

GRASS 7.1.svn (nc_spm_08_grass7):~ > echo $GRASS_PYTHON
python3.4


GRASS 7.1.svn (nc_spm_08_grass7):~ > v.rast.stats
  File 
"/home/neteler/software/grass71/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/forms.py",
line 2375
raise gcmd.GException, _("Unable to parse command '%s'") % ' '.join(cmd)
 ^
SyntaxError: invalid syntax

Did you refer to this problem, Vaclav?

Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] forcing a Python version/install when compiling GRASS

2015-02-20 Thread Vaclav Petras
On Fri, Feb 20, 2015 at 8:25 AM, Markus Neteler  wrote:

> [neteler@pgis_north ]$ alias python=python3.4
>
> [neteler@pgis_north ]$ python --version
> Python 3.4.1
>

I thought alias works just for command line but the processes, e.g.
scripts, does not get them.
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] forcing a Python version/install when compiling GRASS

2015-02-20 Thread Moritz Lennert

On 20/02/15 14:25, Markus Neteler wrote:

On Fri, Feb 20, 2015 at 1:47 PM, Yann Chemin  wrote:

Hi,

I would like to use a different version of Python from the default install in 
the PC,
is there a way to force it in the configure script?


Not (yet) AFAIK. But you can modify it after the "configure" step here:


include/Make/Platform.make:PYTHON  = python

There is at time the hardcoded name:
include/Make/Platform.make.in:PYTHON  = python

Other option: use "alias":

[neteler@pgis_north ]$ python --version
Python 2.7.8

[neteler@pgis_north ]$ alias python=python3.4

[neteler@pgis_north ]$ python --version
Python 3.4.1

Then run "configure" etc. Of course the alias must then persist later,
so put it into $HOME/.bashrc or similar.


Doesn't 'export GRASS_PYTHON=YourChoiceOfPython' simply do the trick at 
runtime ?


Moritz
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] forcing a Python version/install when compiling GRASS

2015-02-20 Thread Markus Neteler
On Fri, Feb 20, 2015 at 1:47 PM, Yann Chemin  wrote:
> Hi,
>
> I would like to use a different version of Python from the default install in 
> the PC,
> is there a way to force it in the configure script?

Not (yet) AFAIK. But you can modify it after the "configure" step here:


include/Make/Platform.make:PYTHON  = python

There is at time the hardcoded name:
include/Make/Platform.make.in:PYTHON  = python

Other option: use "alias":

[neteler@pgis_north ]$ python --version
Python 2.7.8

[neteler@pgis_north ]$ alias python=python3.4

[neteler@pgis_north ]$ python --version
Python 3.4.1

Then run "configure" etc. Of course the alias must then persist later,
so put it into $HOME/.bashrc or similar.

Markus
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


[GRASS-dev] forcing a Python version/install when compiling GRASS

2015-02-20 Thread Yann Chemin
Hi,

I would like to use a different version of Python from the default install in 
the PC,
is there a way to force it in the configure script?

thx
Yann
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev