[GRASS-dev] Re: porting bash scripts to Python (was porting r.in.wms to python)

Michael Barton michael.barton at asu.edu
Mon Oct 6 12:37:01 EDT 2008


I've been really tied up with academic things lately, but want to help  
out with some information here.

See below

On Oct 5, 2008, at 7:16 PM, <grass-dev-request at lists.osgeo.org> <grass-dev-request at lists.osgeo.org 
 > wrote:

> Date: Sun, 5 Oct 2008 22:57:42 +0100
> From: Glynn Clements <glynn at gclements.plus.com>
> Subject: Re: [GRASS-dev] porting r.in.wms to python
> To: grass-dev <grass-dev at lists.osgeo.org>
> Message-ID: <18665.14422.361551.829803 at cerise.gclements.plus.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> Glynn Clements wrote:
>
>> Here's the current status on conversion of scripts to Python:
>
> Apart from the scripts in the "scripts" directory, various parts of
> GRASS install shell scripts. After filtering out the "shell" scripts
> which are actually Tcl/Tk scripts using the "exec $GRASS_WISH" trick,
> I see:
>
> bin/nviz
> etc/Init.sh
> etc/gui/scripts/d.colors.sh

This is a GUI for starting d.colors. It should be deprecated in GRASS 7.

>
> etc/gui/scripts/d.path.sh

Hamish wrote this script

>
> etc/gui/scripts/r.colors.rules
> etc/gui/scripts/r.reclass.file
> etc/gui/scripts/r.reclass.rules
> etc/gui/scripts/r.recode.file
> etc/gui/scripts/r.recode.rules

These 5 scripts need to be deprecated. They were written because it  
used to be impossible to enter the name of a rules file from the GUI  
or even start interactive rules entry in an xterm from the GUI for  
setting colors, reclassification, or recoding.

It is now possible to enter the name of a rules file from the GUI and  
xterms are being deprecated. There is a native TclTk module for  
interactive rules entry, and more sophisticated rules entry modules  
built into the wxPython GUI.

All should be deprecated in GRASS 6.4 and GRASS 7

>
> etc/gui/scripts/r.support.sh

Another GUI wrapper for launching the interactive xterm version of a  
module. Definitely should be deprecated in GRASS 7 and maybe in 6.4.

>
> etc/prompt.sh

I don't know what this is

>
> etc/r.li.setup/masked_area_selection
> etc/r.li.setup/sample_area_vector.sh
> etc/r.li.setup/square_mouse_selection.sh

>
> etc/wxpython/scripts/p.cmd
> etc/wxpython/scripts/p.db
> etc/wxpython/scripts/p.mon
> etc/wxpython/scripts/p.rast
> etc/wxpython/scripts/p.vect

Martin (and Jachym?) wrote these as a way to test out ways to interact  
with a Python display canvas from the command line. I think they have  
lain dormant for awhile, but might be of interest to some in the future.

>
> etc/wxpython/scripts/wxgui

I don't know what this is.

>
> scripts/gis.m

This is replaced by g.gui. It should be deprecated in GRASS 6.4 and  
GRASS 7

>
> scripts/r.li.setup
>
> Of these, Init.sh and prompt.sh should probably stay as shell scripts.

We might want to think about replacing init.sh with a Python version  
of the same is Python becomes a GRASS dependency. It would be  
completely cross-platform. I did some initial playing around with this  
a year ago. It looks pretty simple, though the whole script needs to  
be redone.

Hope this is helpful.

Michael

>
> The former has an equivalent batch file for Windows users, and isn't
> essential. The latter is only probably only useful if you already have
> a Bourne shell.
>
> r.li.setup and the scripts relating to nviz and gis.m all invoke
> Tcl/Tk scripts. These should probably be re-written to use either
> tclsh or wish.
>
> Also, the three etc/gui/scripts/r.*.rules scripts all use
> grass-xterm-wrapper, which no longer exists.
> etc/gui/scripts/r.support.sh also uses grass-xterm-wrapper, but
> r.support's curses-based interactive mode no longer exists.
>
> The scripts relating to the wxPython GUI should be re-written in
> Python (what do those scripts do, anyhow?).
>
> That just leaves the three scripts in etc/r.li.setup. These are all
> shell scripts which rely upon d.mon, so they won't work at present.
>
> Once these issues are dealt with, there should no longer be any need
> to distribute MSys as part of the WinGRASS packages.
>
> Also, should we change windows_launch.bat to invoke Python on the
> scripts, or just install the scripts with a .py extension and add .PY
> to PATHEXT?
>
> -- 
> Glynn Clements <glynn at gclements.plus.com>
>



More information about the grass-dev mailing list