GRASS addons dependencies

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GRASS addons dependencies

Panagiotis Mavrogiorgos
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.

best regards,
Panos

_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS addons dependencies

Panagiotis Mavrogiorgos

On Thu, Feb 4, 2016 at 11:53 PM, Martin Landa <[hidden email]> wrote:
Hi,

2016-02-04 22:28 GMT+01:00 Panagiotis Mavrogiorgos <[hidden email]>:
> 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




_______________________________________________
grass-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-dev
Reply | Threaded
Open this post in threaded view
|

Re: GRASS addons dependencies

Helmut Kudrnovsky
In reply to this post by Panagiotis Mavrogiorgos
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