Skip to content

Commit a907edc

Browse files
committed
fix python version check
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 <[email protected]> Reviewed-by: Michael Brüning <[email protected]>
1 parent 6f92911 commit a907edc

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tools/qmake/mkspecs/features/functions.prf

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,18 @@ defineTest(isPlatformSupported) {
2222
}
2323

2424
defineTest(isPythonVersionSupported) {
25-
python_major_version = $$system('python -c "import sys; print sys.version_info.major"')
26-
python_minor_version = $$system('python -c "import sys; print sys.version_info.minor"')
27-
lessThan(python_major_version, 3): greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true)
28-
skipBuild("Using Python version "$$python_major_version"."$$python_minor_version", but Python version 2 (2.7 or later) is required to build Qt WebEngine.")
29-
return(false)
25+
python_error_msg = "Python version 2 (2.7 or later) is required to build Qt WebEngine."
26+
python_major_version = $$system('python -c "import sys; print(sys.version_info[0])"')
27+
greaterThan(python_major_version, 2) {
28+
skipBuild("Python version 3 is not supported by Chromium.")
29+
skipBuild($$python_error_msg)
30+
return(false)
31+
}
32+
python_minor_version = $$system('python -c "import sys; print(sys.version_info[1])"')
33+
greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): return(true)
34+
skipBuild("Using Python version "$$python_major_version"."$$python_minor_version".")
35+
skipBuild($$python_error_msg)
36+
return(false)
3037
}
3138

3239
defineTest(isGCCVersionSupported) {

0 commit comments

Comments
 (0)