[GRASS-git] [OSGeo/grass] c810f6: init: Output value for sys.path in config (#1835)
noreply at github.com
Tue Nov 30 14:14:33 PST 2021
Author: Vaclav Petras <wenzeslaus at gmail.com>
Date: 2021-11-30 (Tue, 30 Nov 2021)
init: Output value for sys.path in config (#1835)
With this addition, running grass --config python_path outputs the value needed for sys.path. This is useful in Python
where sys.path needs to be set up correctly before the grass package can be imported.
Instead of having to hardcode the etc/python part of the path, user can (optionally) obtain the full path from the new
parameter resulting in a more general code which requires just passing a result of call stripped from the white spaces.
This is especially interesting in combination with #1838 after which GISBASE environmental variable does not have to be
set up before for importing grass.script package, so setting up sys.path is the only step user needs to do before that.
Additionally, with #1829 (and #1979) the installation path (GISBASE) can be determined automatically from the path
to the grass.script.setup module (file), the executable (if it is called grass), or from a user-provided executable which
was be called (by the user) to obtain python_path.
The new setup method is now used in the notebooks.
This simplifoes usage documentaion in setup.py module. No GISBASE is needed. No explicit error checking
(errors are printed and/or raised automatically). sys.path now needs to be str/unicode.
More information about the grass-commit