[GRASS-SVN] r46765 - grass/branches/develbranch_6/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 23 14:36:09 EDT 2011
Author: martinl
Date: 2011-06-23 11:36:09 -0700 (Thu, 23 Jun 2011)
New Revision: 46765
Modified:
grass/branches/develbranch_6/lib/python/setup.py.sed
Log:
pythonlib: define default location/mapset for setup.init()
(merge r46764 from trunk)
Modified: grass/branches/develbranch_6/lib/python/setup.py.sed
===================================================================
--- grass/branches/develbranch_6/lib/python/setup.py.sed 2011-06-23 18:32:08 UTC (rev 46764)
+++ grass/branches/develbranch_6/lib/python/setup.py.sed 2011-06-23 18:36:09 UTC (rev 46765)
@@ -13,7 +13,7 @@
...
@endcode
-(C) 2010 by the GRASS Development Team
+(C) 2010-2011 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
@@ -24,16 +24,16 @@
import os
import tempfile as tmpfile
-def init(gisbase, dbase, location, mapset):
+def init(gisbase, dbase = '', location = 'demolocation', mapset = 'PERMANENT'):
"""!Initialize system variables to run scripts without starting
GRASS explicitly.
User is resposible to delete gisrc file.
@param gisbase path to GRASS installation
- @param dbase path to GRASS database
- @param location location name
- @param mapset mapset within given location
+ @param dbase path to GRASS database (default: '')
+ @param location location name (default: 'demolocation')
+ @param mapset mapset within given location (default: 'PERMANENT')
@return path to gisrc file
"""
os.environ['PATH'] += os.pathsep + os.path.join(gisbase, 'bin') + \
@@ -44,6 +44,9 @@
os.environ['GIS_LOCK'] = str(os.getpid())
+ if not dbase:
+ dbase = gisbase
+
fd, gisrc = tmpfile.mkstemp()
os.environ['GISRC'] = gisrc
os.write(fd, "GISDBASE: %s\n" % dbase)
More information about the grass-commit
mailing list