[GRASS-SVN] r67308 - grass/trunk/lib/python/script
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Dec 21 07:58:18 PST 2015
Author: martinl
Date: 2015-12-21 07:58:18 -0800 (Mon, 21 Dec 2015)
New Revision: 67308
Modified:
grass/trunk/lib/python/script/setup.py
Log:
pythonlib: optionally add wxpython modules to pythonpath when calling
gsetup.init()
Modified: grass/trunk/lib/python/script/setup.py
===================================================================
--- grass/trunk/lib/python/script/setup.py 2015-12-21 15:47:37 UTC (rev 67307)
+++ grass/trunk/lib/python/script/setup.py 2015-12-21 15:58:18 UTC (rev 67308)
@@ -111,7 +111,8 @@
# TODO: there should be a function to do the clean up
# (unset the GISRC and delete the file)
-def init(gisbase, dbase='', location='demolocation', mapset='PERMANENT'):
+def init(gisbase, dbase='', location='demolocation', mapset='PERMANENT',
+ initgui=False):
"""Initialize system variables to run GRASS modules
This function is for running GRASS GIS without starting it
@@ -141,6 +142,8 @@
:param dbase: path to GRASS database (default: '')
:param location: location name (default: 'demolocation')
:param mapset: mapset within given location (default: 'PERMANENT')
+ :param initgui: add also GRASS wxPython packages to PYTHONPATH
+
:returns: path to ``gisrc`` file (to be deleted later)
"""
# TODO: why we don't set GISBASE?
@@ -180,6 +183,8 @@
path = os.getenv('PYTHONPATH')
etcpy = os.path.join(gisbase, 'etc', 'python')
+ if initgui:
+ etcpy += os.pathsep + os.path.join(gisbase, 'gui', 'wxpython')
if path:
path = etcpy + os.pathsep + path
else:
More information about the grass-commit
mailing list