[GRASS-user] Manual to own python script

Hello,

I use my own python script in GRASS but I'd like to add also a html-manual to it, like other modules
and add-ons. Is there any possibility to do that? My script is called Fidimo.py (It seems I have to use the
.py ending) and I tried just to put a file called Fidimo.html into the html folder and afterwards I restarted
GRASS but that is not working...

any suggestions?

/johannes

On Thu, May 12, 2011 at 2:17 PM, Johannes Radinger <jradinger@gmx.at> wrote:

Hello,

I use my own python script in GRASS but I'd like to add also a html-manual to it, like other modules
and add-ons. Is there any possibility to do that? My script is called Fidimo.py (It seems I have to use the
.py ending) and I tried just to put a file called Fidimo.html into the html folder and afterwards I restarted
GRASS but that is not working...

If you use a Makefile to install it, the approach as used for the
existing Python
scripts should work. Of course your script must use the GRASS parser.

Markus

On Mon, May 16, 2011 Markus Neteler:

On Thu, May 12, 2011 at 2:17 PM, Johannes Radinger <jradinger@gmx.at>

...

If you use a Makefile to install it, the approach as used for the
existing Python
scripts should work. Of course your script must use the GRASS parser.

But there is no makefile needed to "install" a python script. It is just necessary to copy
the *.py into the /bin folder and the script can be called with *.py.

Sure. But then you don't get the advantage of getting the doc
autogenerated which
is done by the Makefile.

Anyhow how would and installation with an makefile work?

Just deposit the html file into the same directory.
GRASS 6: name as "description.html"
GRASS 7: name as "<modulename>.html"

the makefile of python scripts contain only little information,

Yes, we tried to keep it minimalistic.

I tried to use the r.buffer makefile and adapt it to my script:

1 MODULE_TOPDIR = ../..
2
3 PGM = r.fidimo.py
4
5 include $(MODULE_TOPDIR)/include/Make/Script.make
6
7 default: script

Perfect.

but what now?? How is that connected to the .html file?

The magic is in $(MODULE_TOPDIR)/include/Make/Script.make if you want to
see how it works. It discovers the HTML file and generates the manual page
when running
make

how do I have to install my script with the makefile (that is very new to me)?

I suspect that you are already done.
Please take a look at

grass70/scripts/<some-script>/

e.g.
http://trac.osgeo.org/grass/browser/grass/trunk/scripts/
or in your local copy.

Markus

-------- Original-Nachricht --------

Datum: Mon, 16 May 2011 13:56:10 +0200
Von: Markus Neteler <neteler@osgeo.org>
An: Johannes Radinger <JRadinger@gmx.at>
CC: GRASS user list <grass-user@lists.osgeo.org>
Betreff: Re: [GRASS-user] Manual to own python script

On Mon, May 16, 2011 Markus Neteler:
>> On Thu, May 12, 2011 at 2:17 PM, Johannes Radinger <jradinger@gmx.at>
...
>> If you use a Makefile to install it, the approach as used for the
>> existing Python
>> scripts should work. Of course your script must use the GRASS parser.
>
> But there is no makefile needed to "install" a python script. It is just
necessary to copy
> the *.py into the /bin folder and the script can be called with *.py.

Sure. But then you don't get the advantage of getting the doc
autogenerated which
is done by the Makefile.

> Anyhow how would and installation with an makefile work?

Just deposit the html file into the same directory.
GRASS 6: name as "description.html"
GRASS 7: name as "<modulename>.html"

> the makefile of python scripts contain only little information,

Yes, we tried to keep it minimalistic.

> I tried to use the r.buffer makefile and adapt it to my script:
>
> 1 MODULE_TOPDIR = ../..
> 2
> 3 PGM = r.fidimo.py
> 4
> 5 include $(MODULE_TOPDIR)/include/Make/Script.make
> 6
> 7 default: script

Perfect.

> but what now?? How is that connected to the .html file?

The magic is in $(MODULE_TOPDIR)/include/Make/Script.make if you want to
see how it works. It discovers the HTML file and generates the manual page
when running
make

> how do I have to install my script with the makefile (that is very new
to me)?

I suspect that you are already done.
Please take a look at

grass70/scripts/<some-script>/

e.g.
http://trac.osgeo.org/grass/browser/grass/trunk/scripts/
or in your local copy.

Hello I am still not sure how to install the script. I've now a folder called MyScript including:
* Makefile
* MyScript.py
* MyScript.py.html

What should I do with this folder? I tried to put the folder into the bin directory but then I can't call the module anymore (nothing happens). Just for your information I work on Mac OSX and GRASS GIS 6.5SVN. I know it from the r.stream add-ons, I had to compile them and then put the add-ons manually into the bin folder and the html files into the html folder. But how to do it with my pyhton script?

/johannes

Markus
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
NEU: FreePhone - kostenlos mobil telefonieren!
Jetzt informieren: http://www.gmx.net/de/go/freephone

On Thu, May 19, 2011 at 4:58 PM, Johannes Radinger <JRadinger@gmx.at> wrote:

On Mon, May 16, 2011 Markus Neteler:

...

Hello I am still not sure how to install the script. I've now a folder called MyScript including:
* Makefile
* MyScript.py
* MyScript.py.html

What should I do with this folder? I tried to put the folder into the bin directory but then I can't call the module anymore (nothing happens).

It must go into the source code or elsewhere.
If you decide to put it along the existing GRASS scripts, just run:
make
make install

otherwise
make MODULE_TOPDIR=/path/to/grass70src/
make MODULE_TOPDIR=/path/to/grass70src/ install

Just for your information I work on Mac OSX and GRASS GIS 6.5SVN. I know it from the r.stream add-ons, I had to compile them and then put the add-ons manually into the bin folder and the html files into the html folder.

The latter should not be needed if you do the "install" step.

But how to do it with my pyhton script?

It works the same way.

Markus

Hej,

I tried as you recommended:

make MODULE_TOPDIR='Applications/GRASS-6.5.app'

but following error occured:

Makefile:5: Applications/GRASS-6.5.app/include/Make/Script.make: No such file or directory
make: *** No rule to make target `Applications/GRASS-6.5.app/include/Make/Script.make'. Stop.

Then I checked and found that the path tho the include folder on Mac is:
'/Applications/GRASS-6.5.app/Contents/MacOS' thats why I tried:
make MODULE_TOPDIR='/Applications/GRASS-6.5.app/Contents/MacOS'

but again a got an error (can't rememeber which one) and when I try to install I get:
noname:Fidimo admin$ make MODULE_TOPDIR='/Applications/GRASS-6.5.app/Contents/MacOS' install
/Applications/GRASS-6.5.app/Contents/MacOS/include/Make/Script.make:47: warning: overriding commands for target `install'
/Applications/GRASS-6.5.app/Contents/MacOS/include/Make/Rules.make:90: warning: ignoring old commands for target `install'
/usr/bin/install -c /Users/admin/Documents/GRASS-Source/grass-6.5.svn_2011_05_05/dist.i386-apple-darwin10.6.0/scripts/Fidimo.py /Applications/GRASS-6.5.app/Contents/MacOS/scripts/
/usr/bin/install -c -m 644 /Users/admin/Documents/GRASS-Source/grass-6.5.svn_2011_05_05/dist.i386-apple-darwin10.6.0/docs/html/Fidimo.py.html /Applications/GRASS-6.5.app/Contents/MacOS/docs/html/
/usr/bin/install -c -m 644 /Users/admin/Documents/GRASS-Source/grass-6.5.svn_2011_05_05/dist.i386-apple-darwin10.6.0/man/man1/Fidimo.py.1 /Applications/GRASS-6.5.app/Contents/MacOS/man/man1/
install: /Users/admin/Documents/GRASS-Source/grass-6.5.svn_2011_05_05/dist.i386-apple-darwin10.6.0/man/man1/Fidimo.py.1: No such file or directory
make: *** [install] Error 71

Anyway I seems that the add-on is installed and it opens when I call it. I didn't test it yet but I think it should work.

For uninstalling respectivly reinstalling a newer version of my script is it just necessary to delete the script from the script-folder and the html from doc? anything else necessary?

/johannes

-------- Original-Nachricht --------

Datum: Mon, 23 May 2011 22:04:10 +0200
Von: Markus Neteler <neteler@osgeo.org>
An: Johannes Radinger <JRadinger@gmx.at>
CC: grass-user@lists.osgeo.org
Betreff: Re: [GRASS-user] Manual to own python script

On Thu, May 19, 2011 at 4:58 PM, Johannes Radinger <JRadinger@gmx.at>
wrote:
>> On Mon, May 16, 2011 Markus Neteler:
...
> Hello I am still not sure how to install the script. I've now a folder
called MyScript including:
> * Makefile
> * MyScript.py
> * MyScript.py.html
>
> What should I do with this folder? I tried to put the folder into the
bin directory but then I can't call the module anymore (nothing happens).

It must go into the source code or elsewhere.
If you decide to put it along the existing GRASS scripts, just run:
make
make install

otherwise
make MODULE_TOPDIR=/path/to/grass70src/
make MODULE_TOPDIR=/path/to/grass70src/ install

> Just for your information I work on Mac OSX and GRASS GIS 6.5SVN. I know
it from the r.stream add-ons, I had to compile them and then put the
add-ons manually into the bin folder and the html files into the html folder.

The latter should not be needed if you do the "install" step.

> But how to do it with my pyhton script?

It works the same way.

Markus

--
NEU: FreePhone - kostenlos mobil telefonieren!
Jetzt informieren: http://www.gmx.net/de/go/freephone

Johannes Radinger wrote:

I tried as you recommended:

make MODULE_TOPDIR='Applications/GRASS-6.5.app'

If you set MODULE_TOPDIR on the command-line, it needs to be an
absolute path.

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