[GRASS-dev] [GRASS GIS] #2132: Create a system for building and running GRASS modules written in Python
GRASS GIS
trac at osgeo.org
Tue Nov 12 17:39:35 PST 2013
#2132: Create a system for building and running GRASS modules written in Python
-------------------------------------------------------+--------------------
Reporter: wenzeslaus | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: svn-trunk
Keywords: makefiles, addons, path, python, packages | Platform: All
Cpu: All |
-------------------------------------------------------+--------------------
Comment(by wenzeslaus):
Replying to [comment:1 zarch]:
> Hi Vaclav,
>
> I can not help to fix the Makefile, It is mysterious to me too!
>
> [[BR]]
>
> > Probably in both cases we need some function which will determine
> > where the package is and will add the path (sys.path) correctly.
> > This function can be in grass.utils, so it will be not necessary
> > to repeat the same code in all modules and then change it when
> > there is an error in it. It could be something like:
>
> [cut]
>
> [[BR]]
>
> I did, and is already in the trunk, maybe we should put in some other
place, at the moment is in
[http://trac.osgeo.org/grass/browser/grass/trunk/lib/python/pygrass/functions.py#L268
pygrass/functions.py] you can find an example of use in
[http://trac.osgeo.org/grass/browser/grass-
addons/grass7/imagery/i.segment.hierarchical/i.segment.hierarchical.py#L153
i.segment.hierarchical]
That's great, thanks for writing it. This is very general function and is
for supporting scripts, so it should go to `grass.script`
(`lib/python/script`), probably to utils. It can be actually in the same
category as `parser` function, I just don't have any nice name for it
(`scripts` would be nice but the whole package is script already, let's
reconsider? ;-).
`i.segment.hierarchical` reminds me that you can have also single GRASS
module written in Python with one or more Python files (Python modules).
This is probably clear and easier but there should be sample Makefile also
for this case.
I will try to use the function. But still, Makefile is the problem in the
first place.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2132#comment:2>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list