#2895: Define dependencies for GRASS addons
-------------------------+-------------------------
Reporter: pmav99 | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Addons | Version: unspecified
Keywords: g.extension | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
Some addons depend on other addons. E.g. `r.lfp` depends on
`r.stream.distance`.
If you install `r.lfp` and you try to use it while `r.stream.distance` is
not installed, you get the following traceback which is not particularly
helpful; especially so if you are not familiar with Python.
{{{
Traceback (most recent call last):
File "/home/grassuser/.grass7/addons/scripts/r.lfp", line 111, in
<module>
sys.exit(main())
File "/home/grassuser/.grass7/addons/scripts/r.lfp", line 43, in main
calculate_lfp(input, output, coords)
File "/home/grassuser/.grass7/addons/scripts/r.lfp", line 67, in
calculate_lfp
distance=flds)
File "/usr/lib/grass70/etc/python/grass/script/core.py", line 392, in
run_command
ps = start_command(*args, **kwargs)
File "/usr/lib/grass70/etc/python/grass/script/core.py", line 361, in
start_command
return Popen(args, **popts)
File "/usr/lib/grass70/etc/python/grass/script/core.py", line 64, in
__init__
subprocess.Popen.__init__(self, args, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
}}}
There should be a way to define GRASS dependencies. E.g. something like
`requirements.txt` that is being used by Python packages.
Optimally `g.extension` should read the list of depedencies and install
missing ones automatically. If `g.extension` does go down this road, then
an additional flag for skipping dependency checks might also be a good
idea.
Perhaps this could/should also be expanded to additional non-GRASS related
dependencies. E.g. `r.denoise` requires the existence of the `mdenoise`
binary. In this case IMHO a graceful failure message would be preferable
to a successful installation of a non-working addon.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2895>
GRASS GIS <https://grass.osgeo.org>