[GRASS-dev] Installing own Python script

Pierre Roudier pierre.roudier at gmail.com
Mon May 30 00:21:47 EDT 2011


Hi,

I'm beginning to script GRASS using Python. Turns out it is very easy
and convivial, and in a very limited amount of time I was able to put
together a little extension to bring the main mathematical morphology
operators to GRASS.

The problem I got, however, is how to install that script into
path/to/grass_src/scripts. In that director, I created a folder named
after my extension (r.mm). It contains:
- my script, r.mm.py
- its doc, r.mm.html, generated by the command python r.mm.py
--html-description, and then completed by hand
- A Makefile

The Makefile is a simple file containing the following lines:

MODULE_TOPDIR = ../..

PGM = r.mm

include $(MODULE_TOPDIR)/include/Make/Script.make

default: script

I've been able to compile the thing once, using make. But I can't run
the make install:

roudierp at A208_RoudierP:/usr/local/src/grass7-svn/grass_trunk/scripts/r.mm> make
/usr/bin/install -c  r.mm.py
/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/scripts/r.mm
if [ "/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/scripts/r.mm"
!= "" ] ; then GISRC=/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/demolocation/.grassrc70
GISBASE=/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu
PATH="/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/bin:$PATH"
PYTHONPATH="/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python:$PYTHONPATH"
LD_LIBRARY_PATH="/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/bin:/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/lib:/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/lib:"
LC_ALL=C /usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/scripts/r.mm
--html-description < /dev/null | grep -v '</body>\|</html>' >
r.mm.tmp.html ; fi
python /usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/tools/mkhtml.py
r.mm > /usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/docs/html/r.mm.html
VERSION_NUMBER=7.0.svn
/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/tools/g.html2man.py
/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/docs/html/r.mm.html
/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/man/man1/r.mm.1
GISRC=/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/demolocation/.grassrc70
GISBASE=/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu
PATH="/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/bin:$PATH"
PYTHONPATH="/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/etc/python:$PYTHONPATH"
LD_LIBRARY_PATH="/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/bin:/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/lib:/usr/local/src/grass7-svn/grass_trunk/dist.x86_64-unknown-linux-gnu/lib:"
LC_ALL=C g.parser -t r.mm.py | sed s/\"/\\\\\"/g | sed 's/.*/_("&")/'
> /usr/local/src/grass7-svn/grass_trunk/locale/scriptstrings/r.mm_to_translate.c
rm r.mm.tmp.html
roudierp at A208_RoudierP:/usr/local/src/grass7-svn/grass_trunk/scripts/r.mm>
make install
make: *** No rule to make target `install'.  Stop.

The wiki page [0] is great, but unfortunately does not provides much
information on that specific point (yet). I'd be more than happy to
contribute it.. as soon as I'll get my head around it!

Any help would be appreciated!

Cheers,

Pierre

[0] http://grass.osgeo.org/wiki/GRASS_and_Python

-- 
Scientist
Landcare Research, New Zealand


More information about the grass-dev mailing list