[GRASS-dev] Re: [GRASS-SVN] r37087 - in grass/trunk/gui: scripts wxpython/scripts

> Martin wrote:
> > is it really needed in trunk in regards we are
> planning to use Python for all scripts?

Hamish:

> AFAIK it is needed whenever non-.exe or .bat named modules will be
> run using simply their command name.

Glynn:

It should only be needed for Tcl/Tk (exec and "open |..."), which has
its own hacks for .exe and .bat (maybe .com and/or .cmd? I'm not
sure).

Everything other than Tcl/Tk falls into one of two cases: either you
always have to provide the extension (even for .exe or .bat), or it
uses PATHEXT and the registry settings (related to ftype/assoc).

AFAICT for non-C modules in g7 Script.make runs the "$(BIN)/%.bat:"
Makefile rule (in ScriptRules.make) which creates .bat file wrapper.

But the helper scripts in $(TOPDIR)/gui/scripts/->$GISBASE/etc/gui/scripts/
do not use Script.make but still need that step.

BTW, we need to add .py to PATHEXT; we don't appear to be
doing this at present.

Index: lib/init/init.bat

--- lib/init/init.bat (revision 37138)
+++ lib/init/init.bat (working copy)
@@ -102,6 +102,7 @@
:wxpython

set PYTHONPATH=%PYTHONPATH%;%WINGISBASE%\etc\python;%WINGISBASE%\etc\wxpython
+set PATHEXT=%PATHEXT%;.PY

python "%GISBASE%/etc/wxpython/gis_set.py"
if %errorlevel% == 2 goto exitinit

for gr7 is it needed for all gui/tui modes I guess, not just wxGUI.
hmph, the above doesn't seem to stick.

On linux at least the .py is removed from the script name and the module
gets installed without extension in $GISBASE/scripts/
I'm note sure what happens with the g7 WinGRASS build.

Hamish

Hamish wrote:

> > > is it really needed in trunk in regards we are
> > planning to use Python for all scripts?
Hamish:
> > AFAIK it is needed whenever non-.exe or .bat named modules will be
> > run using simply their command name.
Glynn:
> It should only be needed for Tcl/Tk (exec and "open |..."), which has
> its own hacks for .exe and .bat (maybe .com and/or .cmd? I'm not
> sure).
>
> Everything other than Tcl/Tk falls into one of two cases: either you
> always have to provide the extension (even for .exe or .bat), or it
> uses PATHEXT and the registry settings (related to ftype/assoc).

AFAICT for non-C modules in g7 Script.make runs the "$(BIN)/%.bat:"
Makefile rule (in ScriptRules.make) which creates .bat file wrapper.

But the helper scripts in $(TOPDIR)/gui/scripts/->$GISBASE/etc/gui/scripts/
do not use Script.make but still need that step.

Nothing should need the .bat wrapper once Tcl/Tk is dropped.

> BTW, we need to add .py to PATHEXT; we don't appear to be
> doing this at present.

Index: lib/init/init.bat

--- lib/init/init.bat (revision 37138)
+++ lib/init/init.bat (working copy)
@@ -102,6 +102,7 @@
:wxpython

set PYTHONPATH=%PYTHONPATH%;%WINGISBASE%\etc\python;%WINGISBASE%\etc\wxpython
+set PATHEXT=%PATHEXT%;.PY

python "%GISBASE%/etc/wxpython/gis_set.py"
if %errorlevel% == 2 goto exitinit

for gr7 is it needed for all gui/tui modes I guess, not just wxGUI.
hmph, the above doesn't seem to stick.

PATHEXT gets reverted?

On linux at least the .py is removed from the script name and the module
gets installed without extension in $GISBASE/scripts/
I'm note sure what happens with the g7 WinGRASS build.

It gets installed without the .py suffix, which won't work. I'll
commit a fix once it's tested.

--
Glynn Clements <glynn@gclements.plus.com>