Browse Source

pythonlib: Set PYTHONPATH to find GRASS Python modules

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@46768 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 years ago
parent
commit
b22a07fba6
1 changed files with 9 additions and 1 deletions
  1. 9 1
      lib/python/setup.py.sed

+ 9 - 1
lib/python/setup.py.sed

@@ -44,6 +44,15 @@ def init(gisbase, dbase = '', location = 'demolocation', mapset = 'PERMANENT'):
     
     os.environ['GIS_LOCK'] = str(os.getpid())
     
+    # Set PYTHONPATH to find GRASS Python modules
+    path = os.getenv('PYTHONPATH')
+    dir  = os.path.join(gisbase, 'etc', 'python')
+    if path:
+	path = dir + os.pathsep + path
+    else:
+	path = dir
+    os.environ['PYTHONPATH'] = path
+    
     if not dbase:
         dbase = gisbase
     
@@ -55,4 +64,3 @@ def init(gisbase, dbase = '', location = 'demolocation', mapset = 'PERMANENT'):
     os.close(fd)
     
     return gisrc
-