Checking for 'pythonw' only on Windows

On Mac OS X, checking for pythonw can return a path to an ancient 2.4 version of
Python in some cases. We don't want that.
This commit is contained in:
Strahinja Val Markovic 2013-11-05 15:30:34 -08:00
parent 207a0779c3
commit 4aa207c2ad

View File

@ -80,13 +80,16 @@ def GetUnusedLocalhostPort():
def PathToPythonInterpreter():
# We check for 'pythonw' first because that covers the Windows use case (and
# 'pythonw' doesn't pop-up a console window like running 'python' does).
# We check for 'python2' before 'python' because some OS's (I'm looking at you
# Arch Linux) have made the... interesting decision to point /usr/bin/python
# to python3.
path_to_python = PathToFirstExistingExecutable(
[ 'pythonw', 'python2', 'python' ] )
python_names = [ 'python2', 'python' ]
if OnWindows():
# On Windows, 'pythonw' doesn't pop-up a console window like running
# 'python' does.
python_names.insert( 0, 'pythonw' )
path_to_python = PathToFirstExistingExecutable( python_names )
if path_to_python:
return path_to_python