[GRASS-SVN] r44388 - grass/branches/develbranch_6/lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 23 09:04:24 EST 2010
Author: martinl
Date: 2010-11-23 06:04:24 -0800 (Tue, 23 Nov 2010)
New Revision: 44388
Modified:
grass/branches/develbranch_6/lib/python/core.py
Log:
grass.init() added
Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py 2010-11-23 13:57:01 UTC (rev 44387)
+++ grass/branches/develbranch_6/lib/python/core.py 2010-11-23 14:04:24 UTC (rev 44388)
@@ -30,6 +30,7 @@
import atexit
import subprocess
import shutil
+import tempfile as tmpfile
# i18N
import gettext
@@ -1001,6 +1002,22 @@
return 0
+def init(gisbase, dbase, location, mapset):
+ os.environ['PATH'] += ':' + os.path.join(gisbase, 'bin') + ':' + \
+ os.path.join(gisbase, 'scripts')
+ os.environ['LD_LIBRARY_PATH'] = os.path.join(gisbase, 'lib')
+
+ os.environ['GIS_LOCK'] = str(os.getpid())
+
+ fd, gisrc = tmpfile.mkstemp()
+ os.environ['GISRC'] = gisrc
+ fd.write("GISDBASE: %s\n" % dbase)
+ fd.write("LOCATION_NAME: %s\n" % location)
+ fd.write("MAPSET: %s\n" % mapset)
+ fd.close()
+
+ return gisrc
+
# get debug_level
if find_program('g.gisenv', ['--help']):
debug_level = int(gisenv().get('DEBUG', 0))
More information about the grass-commit
mailing list