[GRASS-dev] GRASS extensions/addons mismatch

Hamish hamish_b at yahoo.com
Wed Dec 21 14:23:17 EST 2011


Michael wrote:
> This all assumes that it is necessary to use shell
> environmental variables.

 $PATH needs to be updated, and that has to happen before the shell is
launched, or you need to `source` the update on the command line. You
can't run a program to change it, as the change will only take effect in
that program, and disappear once that program (or script) ends. Changing
g.gisenv won't update $PATH, you need to restart GRASS for that. The GUI
has a bit more flexibility as it can manage its $PATH in the background
in an ongoing way.  GRASS can't check g.gisenv and reset the PATH every
time a module is called. (well I suppose it could, but it would slow
things down, and if it can't find the program in the first place how's it
going to tell itself where else to look to find it?)


If a script is not in the path you can still get it's --help text, but
when you run it, the internal g.parser step re-runs the program and if it
is not in the $PATH it can't find itself on the second pass. all grass
addon scripts need to be in the $PATH to function.


you might ask if lib/init/grass.py could also parse ~/.grass7/rc for a
GRASS_ADDON_PATH variable, and it could, but it doesn't get away from
the need to restart GRASS for it to take effect (ie update $PATH).
fwiw it doesn't have to be a one or the other thing, although that does
get a bit messy. and since it's fundamentally an environment variable
(ie $PATH) which needs to be modified ...


Hamish


More information about the grass-dev mailing list