[issue21821] The function cygwinccompiler.is_cygwingcc leads to FileNotFoundError under Windows 7
Aaron Meurer
report at bugs.python.org
Thu Sep 25 00:50:58 CEST 2014
Aaron Meurer added the comment:
The issue is that that the Anaconda gcc on Windows is a bat file, so it can't find it. Another fix would be to use find_executable. This is because Anaconda has patched find_executalbe (which it also would be good to get backported)
diff --git Lib/distutils/spawn.py Lib/distutils/spawn.py
index b1c5a44..4703f00 100644
--- Lib/distutils/spawn.py
+++ Lib/distutils/spawn.py
@@ -156,17 +156,16 @@ def find_executable(executable, path=None):
path = os.environ['PATH']
paths = path.split(os.pathsep)
- base, ext = os.path.splitext(executable)
-
- if (sys.platform == 'win32') and (ext != '.exe'):
- executable = executable + '.exe'
-
- if not os.path.isfile(executable):
- for p in paths:
- f = os.path.join(p, executable)
- if os.path.isfile(f):
- # the file exists, we have a shot at spawn working
- return f
- return None
- else:
- return executable
+
+ for ext in '.exe', '.bat', '':
+ newexe = executable + ext
+
+ if os.path.isfile(newexe):
+ return newexe
+ else:
+ for p in paths:
+ f = os.path.join(p, newexe)
+ if os.path.isfile(f):
+ # the file exists, we have a shot at spawn working
+ return f
+ return None
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21821>
_______________________________________
More information about the Python-bugs-list
mailing list