Drop or fix setting of Location and Mapset using environmental variables
|Reported by:||wenzeslaus||Owned by:|
|Keywords:||init, grass.py, interface, CLI, script, batch job||Cc:|
$ export GISDBASE=~/grassdata/ $ export LOCATION_NAME=nc_spm_08_grass7_tests_2 $ export MAPSET=landsat $ .../grass71 - Cleaning up temporary files... Starting GRASS GIS... Traceback (most recent call last): File ".../grass71", line 1423, in <module> non_interactive(args) File ".../grass71", line 586, in non_interactive if gisdbase and location_name and mapset: NameError: global name 'gisdbase' is not defined
Also the dash used in this context seems quite strange, especially for GRASS. We should consider alternatives.
In general this behavior seems useless to me, why use environmental variable when I can use parameter? However, it might become quite useful with the "exec subcommand" (#2579) for running commands inside the session. You would set the environment and then just call grass:
export GISDBASE=~/grassdata/ export LOCATION_NAME=nc_spm_08_grass7_tests_2 export MAPSET=landsat grass7 - exec g.region -p
Do we want to restore this behavior or it is ok to drop it?
If we want to fix also 7.0, some copy & paste should be possible.
PS: Either way, I won't be able to work on it right now, so if somebody can take over, it would be great. (It should be much easier now after the refactoring. There are notes in the source code about what needs to be done.)