[GRASS-dev] question about python scripts on Windows again

Glynn Clements glynn at gclements.plus.com
Thu Jan 28 10:28:14 EST 2010


Glynn Clements wrote:

> > > One solution is to merge the support for the -s switch from 7.0.
> > 
> > What does the -s switch do?
> 
> It writes the option settings to stdout then quits, rather than trying
> to re-invoke the script with the options added to the environment.
> 
> In 7.0, grass.script.parser() invokes g.parser with the -s switch and
> parses its output to initialise the options/flags dictionaries.

I considered extending this feature to shell scripts, writing shell
syntax to stdout like with g.gisenv.

Unfortunately, this doesn't allow for --interface-description etc. 
These write text which is supposed to go to the script's stdout, and
eval `g.parser ...` would interfere with that.

The Python code handles this by checking for the @ARGS_PARSED@ token,
parsing the output if this is present and echoing it to stdout
otherwise. Doing this in the shell would be somewhat more work (in
practice, we'd need a "library" which was sourced by each script), so
I'm not sure that it's worth it.

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


More information about the grass-dev mailing list