From a907edc50641ddc634934747ad3c158d05dc7361 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 30 Sep 2015 10:52:05 +0200 Subject: fix python version check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The python code that is used to determine the version number did not work with python3. In python3 print is a real function and must be called as such. Use positional accessors to be compatible with python < 2.6. Also extend the error message for users that attempt the build with python3. Task-number: QTBUG-48507 Change-Id: I49e1fb77c2cc421ac1faed8d8143bf605fbde700 Reviewed-by: Florian Bruhin Reviewed-by: Michael BrĂ¼ning --- tools/qmake/mkspecs/features/functions.prf | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index 69d3fd3b2..64064bddb 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -22,11 +22,18 @@ defineTest(isPlatformSupported) { } defineTest(isPythonVersionSupported) { - python_major_version = $$system('python -c "import sys; print sys.version_info.major"') - python_minor_version = $$system('python -c "import sys; print sys.version_info.minor"') - lessThan(python_major_version, 3): greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true) - skipBuild("Using Python version "$$python_major_version"."$$python_minor_version", but Python version 2 (2.7 or later) is required to build Qt WebEngine.") - return(false) + python_error_msg = "Python version 2 (2.7 or later) is required to build Qt WebEngine." + python_major_version = $$system('python -c "import sys; print(sys.version_info[0])"') + greaterThan(python_major_version, 2) { + skipBuild("Python version 3 is not supported by Chromium.") + skipBuild($$python_error_msg) + return(false) + } + python_minor_version = $$system('python -c "import sys; print(sys.version_info[1])"') + greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true) + skipBuild("Using Python version "$$python_major_version"."$$python_minor_version".") + skipBuild($$python_error_msg) + return(false) } defineTest(isGCCVersionSupported) { -- cgit v1.2.3