浏览代码

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 年之前
父节点
当前提交
b22a07fba6
共有 1 个文件被更改,包括 9 次插入1 次删除
  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
-