[GRASS-dev] Makefile related problem? Re: [GRASS-user] Confused when using i.fusion.brovey

Vaclav Petras wenzeslaus at gmail.com
Mon Nov 10 07:40:15 PST 2014


On Mon, Nov 10, 2014 at 10:03 AM, Nikos Alexandris <nik at nikosalexandris.net>
wrote:

> Nikos Alexandris wrote:
>
> > > I have this script
> > > <https://github.com/NikosAlexandris/i.fusion.hpf.py>. My local
> > > Makefile, with which I am trying to compile currently, is:
>
> > >   MODULE_TOPDIR = ../..
> > >
> > >   PGM = i.fusion.hpf
> > >
> > >   ETCFILES = high_pass_filter constants
> > >
> > >   include $(MODULE_TOPDIR)/include/Make/Script.make
> > >   include $(MODULE_TOPDIR)/include/Make/Python.make
>
> > > * Is the order of entries in ETCFILES significant? (high_pass_filter
> > > needs stuff from constants)
>
> > > * While both files are to be found, after compilation, under
> > > </grass70/dist.x86_64-unknown-linux-gnu/etc/i.fusion.hpf>, the script
> > > runs fine only when executing it from *any*, if I understand
> > > correctly, directory in which the helper file(s)
> > > "high_pass_filter.py(c)" is(are) in.
>
> > > I can't work this out. Thank you, Nikos
> >
> > Thanks to "r.in.wms", fixed by using this line:
> >
> > +sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc',
> > 'r.in.wms'))
>
> This approach broke for my script i.fusion.hpf again. The sys.path[0] is
> an empty string (now). I have
> no idea why it did work before.
>
> Is the approach in v.class.ml relevant/better/safer:
> <
> http://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.class.ml/v.class.ml.py?order=date#L380
> >?
>

This is used on more places. I suggest to go with that although I'm afraid
it is not perfect either.

See other examples:
http://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.modis/r.modis.import/r.modis.import.py#L95
http://trac.osgeo.org/grass/browser/grass-addons/grass7/imagery/i.segment.hierarchical/i.segment.hierarchical.py#L153

See the implementation:
http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/pygrass/utils.py#L264

See related tickets:
http://trac.osgeo.org/grass/ticket/2132
https://trac.osgeo.org/grass/ticket/2097


>
> Nikos
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20141110/d1790f93/attachment.html>


More information about the grass-dev mailing list