OSGeo / grass-addons

GRASS GIS Addons Repository
https://grass.osgeo.org/grass-stable/manuals/addons/
GNU General Public License v2.0
103 stars 154 forks source link

[Bug] r.diversity: Potential GRASS 8 compatibility issue #665

Closed echoix closed 2 years ago

echoix commented 2 years ago

Name of the addon r.diversity

Describe the bug The r.diversity addon seams to add additional checks and builds a path to a config directory using an hardcoded "GRASS7" or ".grass7" string. In the imminent release of GRASS 8, this should lead to a compatibility issue.

To Reproduce Steps to reproduce the behavior:

  1. Open a GRASS 8 installation on a computer that never had a GRASS 7 installation (No GRASS7 folders in APPDATA on Windows, or no .grass7 folder in the user profile for others like Linux)
  2. Install r.diversity addon (like g.extension r.diversity.
  3. Try launching an example command, like r.diversity input=ndvi_map prefix=diversity alpha=0.5 (from the manual page)
  4. See if there is an error.

Expected behavior r.diversity should install and run in GRASS 8 like it did on GRASS 7

Screenshots See the following lines in the addon's source code: https://github.com/OSGeo/grass-addons/blob/b7a36ebd8001fc77cdf11d8673e4dc7b8ec2fdef/src/raster/r.diversity/r.diversity.py#L86-L101

System description (please complete the following information): I don't have a GRASS 8 only installation to confirm issue, so irrelevant (sorry).

Additional context I observed this potential issue when proofreading the raster addons recently.

Originally posted by @echoix in https://github.com/OSGeo/grass-addons/issues/664#issuecomment-1008345218

neteler commented 2 years ago

Note: It appears that also other addons require a related update (both in code and HTML manuals):

ag -l '\.grass7' 
general/g.cloud/cloud_collect.sh
general/g.cloud/test/launch_SGE_grassjob.sh
general/g.cloud/g.cloud.py
imagery/i.modis/i.modis.download/i.modis.download.html
raster/r.diversity/r.diversity.py
raster/r.stream.variables/r.stream.variables.sh
raster/r.stream.watersheds/r.stream.watersheds.sh
tools/mk_isis_menu.README
tools/mk_isis_menu.sh
wenzeslaus commented 2 years ago

Easy to fix, but ideally, there would be an API to obtain that path.