diff --git Lib/distutils/spawn.py Lib/distutils/spawn.py index 5dd415a..ce85901 100644 --- Lib/distutils/spawn.py +++ Lib/distutils/spawn.py @@ -176,17 +176,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