浏览代码

libpython/setup: define also GRASS_PYTHON if not defined
(merge https://trac.osgeo.org/grass/changeset/67288 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@67289 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 9 年之前
父节点
当前提交
189f6652dc
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      lib/python/script/setup.py

+ 7 - 2
lib/python/script/setup.py

@@ -171,8 +171,13 @@ def init(gisbase, dbase='', location='demolocation', mapset='PERMANENT'):
 
     os.environ['GIS_LOCK'] = str(os.getpid())
 
-    # Set PYTHONPATH to find GRASS Python modules
-    # TODO: isn't this useless? user already imported this somehow
+    # Set GRASS_PYTHON and PYTHONPATH to find GRASS Python modules
+    if not os.getenv('GRASS_PYTHON'):
+        if sys.platform == 'win32':
+            os.environ['GRASS_PYTHON'] = "python.exe"
+        else:
+            os.environ['GRASS_PYTHON'] = "python"
+    
     path = os.getenv('PYTHONPATH')
     etcpy = os.path.join(gisbase, 'etc', 'python')
     if path: