[GRASS-SVN] r68022 - grass-addons/grass7/raster/r.green/r.green.install

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 8 09:02:53 PST 2016


Author: zarch
Date: 2016-03-08 09:02:53 -0800 (Tue, 08 Mar 2016)
New Revision: 68022

Modified:
   grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py
Log:
r.green: fix PATH to find the pip executable under windows

Modified: grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py
===================================================================
--- grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py	2016-03-08 13:07:34 UTC (rev 68021)
+++ grass-addons/grass7/raster/r.green/r.green.install/r.green.install.py	2016-03-08 17:02:53 UTC (rev 68022)
@@ -353,7 +353,7 @@
 def get_pip_win_env():
     """Add pip path to the windows environmental variable"""
     os_pth = os.__file__.split(os.path.sep)
-    script_pth = os.path.join(*(os_pth[:-2] + ['Scripts', ]))
+    script_pth = os.sep.join(os_pth[:-2] + ['Scripts', ])
     if not os.path.exists(script_pth):
         msg = "The directory containing python scripts does not exist!"
         raise Exception(msg)
@@ -382,9 +382,10 @@
 
 def check_install_pip(install=False):
     """Check if pip is available"""
+    env = get_pip_win_env() if 'win' in sys.platform else {}
     # run pip and check return code
     popen_pip = subprocess.Popen(['pip', '--help'],
-                                 stdout=subprocess.PIPE, shell=True)
+                                 stdout=subprocess.PIPE, shell=True, env=env)
     if popen_pip.wait():
         print('pip is not available')
         if install:



More information about the grass-commit mailing list