[GRASS-dev] Fwd: Re: [GRASS-user] script html manual file directory

Moritz Lennert mlennert at club.worldonline.be
Thu May 3 05:09:20 PDT 2018


Forwarding this to grass-dev as I think there are more people here that 
might be able to help:


-------- Forwarded Message --------
Subject: 	Re: [GRASS-user] script html manual file directory
Date: 	Wed, 2 May 2018 23:51:21 +0200
From: 	Frank David <frank.david at geophom.fr>
Organization: 	Geophom
To: 	Moritz Lennert <mlennert at club.worldonline.be>
CC: 	grass-user at lists.osgeo.org



Hi all,

Thank you for your advices Moritz !

I succeed (I guess..) to make a package  with several python scripts 
(one by sub-folder) and a shared library (in its own sub-folder). I can 
install with g.extension (only in command line) (why?). But the entries 
does not appear in g.extension list because they are not in  in 
.grass7/addons/modules.xml. I do not find anything about the way to add 
my entries in that file. It's not a part of Makefile commands. How it's 
handled ?

I notice that: if I install twice my package (suite) with g.extension, 
the library sub-folder is copied inside the library sub-folder (one 
level too low and do not replace), if I install once again, the library 
replace the lowest level folder. So, If i update the library I must 
remove manually the library to keep it at the right level. Do you  have 
an idea of the reason ? (I suppose Makefile, but I don't understand - 
see below the Makefile)

I have created a custom menu toolboxes.xml. Is there a way ton install 
my menu and insert the sub-toolbox in main_menu.xml ?

Concerning french accent, as you suggest, I can use html special 
characters &xxx; for the <description> part, and it works. But not in 
the #% description module entries of the python script for correct 
display in gui. However, the manual display bad characters in the upper 
section (like é for é), and good in the lowest... Is there a way to 
have accent both in gui and manual ?

Regards,

Frank

_Library Makefile:_

MODULE_TOPDIR = ../../..

include $(MODULE_TOPDIR)/include/Make/Other.make
include $(MODULE_TOPDIR)/include/Make/Python.make

MODULES = utils __init__

PGM = r.wtg
LIBDIR = libwtg
ETCDIR = $(ETC)/$(PGM)/$(LIBDIR)

PYFILES := $(patsubst %,$(ETCDIR)/%.py,$(MODULES))
PYCFILES := $(patsubst %,$(ETCDIR)/%.pyc,$(MODULES))

default: $(PYFILES) $(PYCFILES)

$(ETCDIR):
      $(MKDIR) $@

$(ETCDIR)/%: % | $(ETCDIR)
      $(INSTALL_DATA) $< $@

install:
      $(MKDIR) $(INST_DIR)/etc/$(PGM)
      cp -r $(ETCDIR) $(INST_DIR)/etc/$(PGM)/$(LIBDIR)


Le 27/04/2018 à 17:34, Moritz Lennert a écrit :
> Le Fri, 27 Apr 2018 16:08:00 +0200,
> Frank David<frank.david at geophom.fr>  a écrit :
>
>> Thank you Moritz,
>>
>> I succeed to install python script, But.. my script use a custom lib
>> in a sub-folder for my shared functions, so g.extension fails with
>> the line "from gg.geolib import *". How may I manage this included
>> lib ?
>>
> Check examples of other scripts and how they handle this. For example:
> r.agent [1] or r.green [2].
>
> Check the Makefiles at each level, including the one in the
> library directory, and how the set the path for import of the library
> files before importing them:
>
>  From r.agent.rand [3]:
>
> from grass.pygrass.utils import set_path
>
> set_path('r.agent', 'libagent', '..')
> from libagent import error, grassland, world
>
>
>> Without this include, install works (only on console, not with gui)
> You would need to give us more details: what do you do exactly and what
> doesn't work ?
>
>> and allows to exec the script from console. I notice encoding manual
>> is not in UTF-8. Is it possible to force UTF-8 encoding ?.
> I don't think so, but others should know better than me. If you want to
> include accented characters, you should use html symbol codes (i.e.
> '&‌agrave;' for à, etc).
>
>> However,
>> my custom menu (toolboxes.xml) fails with the following error :
>>
>> "/usr/local/grass-7.4.0svn/gui/wxpython/lmgr/frame.py", line
>> 905, in OnMenuCmd
>>
>> GUI(parent=self, giface=self._giface).ParseCommand(cmd)
>>     File
>> "/usr/local/grass-7.4.0svn/gui/wxpython/gui_core/forms.py",
>> line 2834, in ParseCommand
>>
>> raise gcmd.GException(e.value)
>> core.gcmd
>> .
>> GException
>> :
>> Unable to fetch interface description for command
>> 'gzvibin.py'.
>> Details: [Errno 2] No such file or directory
> This sounds like it cannot find gzvibin.py. How and where did you
> 'install' it ?
>
> Moritz
>
>
> [1]
> https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.agent
> [2]
> https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.green
> [3]
> https://trac.osgeo.org/grass/browser/grass-addons/grass7/raster/r.agent/r.agent.rand/r.agent.rand.py#L91




More information about the grass-dev mailing list