[GRASS-dev] Installing own Python script

Glynn Clements glynn at gclements.plus.com
Mon May 30 10:02:46 EDT 2011


Pierre Roudier wrote:

> 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 r.mm.html file should not contain the parts which are generated by
"r.mm.py --html-description". The build system does this automatically
if the .html file doesn't contain an "<html>" tag. This ensures that
the .html file is kept up to date if options are added, removed or
changed.

> 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 install
> make: *** No rule to make target `install'.  Stop.

There is no "install" target for scripts, only for (compiled) modules. 
You would have the same issue for any of the existing scripts.

Normally, GRASS is installed as a whole by running "make install" from
the top-level directory, which copies the staging directory
(dist.<arch>) to the final location.

The per-module "install" targets are for developers wishing to install
individual modules after modifications. As GRASS can be run from the
staging directory without being installed, this isn't often required.

If this feature is desired for scripts, it should just be a case of
adding a slight modification of r43657 to Script.make (change "bin" to
"scripts" in the first command).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list