[GRASS-dev] GRASS extensions/addons mismatch

Michael Barton Michael.Barton at asu.edu
Wed Dec 21 13:13:36 EST 2011



On Dec 20, 2011, at 6:34 PM, Hamish wrote:

> fwiw it would be possible to have wxGUI preferences save a custom addon
> dir which it could save into ~/.grass/wx & add to the environment when
> you click Apply and also upon startup.

To a large extent, this already is implemented.

> And you can add it to ~/.grass.bashrc
> and have the shell script version of g.extension pick it up and use it.

This is not really necessary if we use GRASS environmental variable.s

> 
> ... but that still doesn't get it into $PATH to run it.
> 
> 
> alternatively, in init.sh we could move
>  cat "$USERHOME/.grass.bashrc" >> "$bashrc"
> 
> until after
>   echo 'export GRASS_SHELL_PID=$$' >> "$bashrc"
> 
> but then you'd have to add
>  PATH="$GRASS_ADDON_PATH:$PATH"
> 
> to your .grass.bashrc file..

This all assumes that it is necessary to use shell environmental variables. Perhaps part of the problem is that there is no GRASS shortcut for the shell string substitution call "$". I suppose we could think about adding one (e.g., %GRASS_ADDON_PATH would be a 'GRASS string substitutions'), but it's not clear to me that it is really necessary. There are other ways that already exist to get the value set for these variables. The other is the path issue itself. Since there is a mechanism for GRASS to read and use other GRASS variables, why can't it use GRASS_ADDON_PATH as a GRASS variable instead of a shell variable. This would make all of this a lot easier. 

> 
> It is possible to rearrange init.sh to add some conditional magic into
> $MAPSET/.bashrc so a value in ~/.grass.bashrc would be added to the
> shell's $PATH, but it is invasive enough that I would not like to touch
> it before 6.4.2. Also you'd have to do the same for csh and MinGW/other
> shells.

Again, if we switched from a shell variable to a GRASS variable, it seems that all this would not be necessary.

Michael



More information about the grass-dev mailing list