[GRASS-dev] GRASS addons dependencies

Hi everybody,

Some addons depend on other addons. E.g. r.lfp depends on r.stream.distance.

If 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
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

So my question is whether there is a way to define addon dependencies, and if there is not, what would be a sensible way to support something like this.

best regards,
Panos

Panagiotis Mavrogiorgos wrote

Hi everybody,

Some addons depend on other addons. E.g. r.lfp depends on
r.stream.distance.

If 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

So my question is whether there is a way to define addon dependencies, and
if there is not, what would be a sensible way to support something like
this.

have a look here:

https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.basin/r.basin.py#L82

82 # check requirements
83 def check_progs():
84 found_missing = False
85 for prog in ('r.hypso', 'r.stream.basins', 'r.stream.distance',
'r.stream.extract',
86 'r.stream.order','r.stream.snap','r.stream.stats', 'r.width.funct'):
87 if not grass.find_program(prog, '--help'):
88 found_missing = True
89 grass.warning(_("'%s' required. Please install '%s' first
using 'g.extension %s'") % (prog, prog, prog))
90 if found_missing:
91 grass.fatal(_("An ERROR occurred running r.basin"))

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS-addons-dependencies-tp5248966p5249030.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

On Thu, Feb 4, 2016 at 11:53 PM, Martin Landa <landa.martin@gmail.com>
wrote:

Hi,

2016-02-04 22:28 GMT+01:00 Panagiotis Mavrogiorgos <pmav99@gmail.com>:
> So my question is whether there is a way to define addon dependencies,
and
> if there is not, what would be a sensible way to support something like
> this.

currently it's not possible. Please fill the ticket. Martin

Here is the ticket: https://trac.osgeo.org/grass/ticket/2895#ticket