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.da...@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.
'à' 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