Re: [GRASS-user] script html manual file directory
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 for the 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 Davida é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. 'à' 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 -- *Geophom* 327 rue de Vieille Cour 44521 OUDON Tel +33(0)2 85 52 02 59 - Port +33(0)6 04 47 91 06 www.geophom.fr ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] script html manual file directory
Le Fri, 27 Apr 2018 16:08:00 +0200, Frank Davida é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. 'à' 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 ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] script html manual file directory
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 ? Without this include, install works (only on console, not with gui) 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 ?. 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 Thank you for your help. Frank Le 26/04/2018 à 14:36, Moritz Lennert a écrit : On 26/04/18 12:05, Frank David wrote: Dear all, I would like to setup the manual page of my python scripts in the gui. I alreaday create them from --html-description and put them in my script directory. But it does not work. I tried in ../docs/html/ but without sccess. If I copy them in /usr/local/grass-7.4.0/docs/html it works ! Is there any way (html path variable ?) to use html from a personnal directory ? You can install your scripts as extension modules. Then the man pages will be installed in .grass7/addons/docs. The easiest would be to create a directory for each module with the code, a ModuleName.html file with the sections DESCRIPTION, NOTES, AUTHOR, etc (but not the output of --html-description, this will be added automatically !), and a Makefile. You can then call g.extension with the url= parameter pointing to that directory and everything will be installed automatically. Look at any of the Python modules in https://trac.osgeo.org/grass/browser/grass-addons/grass7 to see how to write the Makefile and what the content of the .html file looks like. Moritz -- *Geophom* 327 rue de Vieille Cour 44521 OUDON Tel +33(0)2 85 52 02 59 - Port +33(0)6 04 47 91 06 www.geophom.fr ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] script html manual file directory
On 26/04/18 12:05, Frank David wrote: Dear all, I would like to setup the manual page of my python scripts in the gui. I alreaday create them from --html-description and put them in my script directory. But it does not work. I tried in ../docs/html/ but without sccess. If I copy them in /usr/local/grass-7.4.0/docs/html it works ! Is there any way (html path variable ?) to use html from a personnal directory ? You can install your scripts as extension modules. Then the man pages will be installed in .grass7/addons/docs. The easiest would be to create a directory for each module with the code, a ModuleName.html file with the sections DESCRIPTION, NOTES, AUTHOR, etc (but not the output of --html-description, this will be added automatically !), and a Makefile. You can then call g.extension with the url= parameter pointing to that directory and everything will be installed automatically. Look at any of the Python modules in https://trac.osgeo.org/grass/browser/grass-addons/grass7 to see how to write the Makefile and what the content of the .html file looks like. Moritz ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] script html manual file directory
Dear all, I would like to setup the manual page of my python scripts in the gui. I alreaday create them from --html-description and put them in my script directory. But it does not work. I tried in ../docs/html/ but without sccess. If I copy them in /usr/local/grass-7.4.0/docs/html it works ! Is there any way (html path variable ?) to use html from a personnal directory ? I'm using Grass 7.4.0svn on Debian Stretch Thanks for your help. Frank ___ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user