Python: Don't use named tuples to get the version

sys.version_info.major is only possible on 2.7+ or so.
Therefore, we now use [0] instead.
This commit is contained in:
Samuel John 2013-06-04 17:14:15 +02:00
parent 623b21a7bd
commit 8781950294

View File

@ -74,7 +74,7 @@ class PythonInstalled < Requirement
elsif version < @min_version elsif version < @min_version
@unsatisfied_because += "Python version #{version} is too old (need at least #{@min_version})." @unsatisfied_because += "Python version #{version} is too old (need at least #{@min_version})."
false false
elsif @min_version.major == 2 && `python -c "import sys; print(sys.version_info.major)"`.strip == "3" elsif @min_version.major == 2 && `python -c "import sys; print(sys.version_info[0])"`.strip == "3"
@unsatisfied_because += "Your `python` points to a Python 3.x. This is not supported." @unsatisfied_because += "Your `python` points to a Python 3.x. This is not supported."
false false
else else
@ -240,7 +240,7 @@ class PythonInstalled < Requirement
# Don't print from here, or else universe will collapse. # Don't print from here, or else universe will collapse.
import sys import sys
if sys.version_info.major == #{version.major} and sys.version_info.minor == #{version.minor}: if sys.version_info[0] == #{version.major} and sys.version_info[1] == #{version.minor}:
if sys.executable.startswith('#{HOMEBREW_PREFIX}'): if sys.executable.startswith('#{HOMEBREW_PREFIX}'):
# Fix 1) # Fix 1)
# A setuptools.pth and/or easy-install.pth sitting either in # A setuptools.pth and/or easy-install.pth sitting either in