[GRASS-SVN] r74225 - grass/trunk/lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 12 14:48:48 PDT 2019


Author: neteler
Date: 2019-03-12 14:48:48 -0700 (Tue, 12 Mar 2019)
New Revision: 74225

Modified:
   grass/trunk/lib/python/script/core.py
Log:
python script core: shutil_which() exception fix for Python 3 (fixes #3773)

Modified: grass/trunk/lib/python/script/core.py
===================================================================
--- grass/trunk/lib/python/script/core.py	2019-03-12 19:59:57 UTC (rev 74224)
+++ grass/trunk/lib/python/script/core.py	2019-03-12 21:48:48 UTC (rev 74225)
@@ -164,7 +164,7 @@
 
     return set(cmd), scripts
 
-
+# TODO: Please replace this function with shutil.which() before 8.0 comes out
 # replacement for which function from shutil (not available in all versions)
 # from http://hg.python.org/cpython/file/6860263c05b3/Lib/shutil.py#l1068
 # added because of Python scripts running Python scripts on MS Windows
@@ -239,6 +239,8 @@
                     return name
     return None
 
+if sys.version_info.major > 2:
+    shutil_which = shutil.which
 
 # Added because of scripts calling scripts on MS Windows.
 # Module name (here cmd) differs from the file name (does not have extension).



More information about the grass-commit mailing list