diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-04-25 12:46:36 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-04-27 09:35:01 +0000 |
commit | e453be82f510303e41a24c0093bd03c7f8374f75 (patch) | |
tree | b38160e341c96fa4cda4b20577c812affcdb2b90 /tools/qmake | |
parent | 3b24c024f2606cd93b1f397338f349582003c2ce (diff) |
Make python2 usage more robust
After configuring Qt there will be an error message if a suitable python
version could not be found.
Add python2 configure test that
- first looks for python2 in PATH
- then looks for python in PATH
- checks the Python version
- stores the result in QMAKE_PYTHON2
Use $$QMAKE_PYTHON2 everywhere where we call python.
Pass $$QMAKE_PYTHON2 to gn for its exec_script feature.
Task-number: QTBUG-60164
Change-Id: I33de1273cbd20a787b3c8889d35280784dbcd5ae
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'tools/qmake')
-rw-r--r-- | tools/qmake/mkspecs/features/functions.prf | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/tools/qmake/mkspecs/features/functions.prf b/tools/qmake/mkspecs/features/functions.prf index ed1133037..eb421f8b5 100644 --- a/tools/qmake/mkspecs/features/functions.prf +++ b/tools/qmake/mkspecs/features/functions.prf @@ -86,7 +86,6 @@ defineTest(isPlatformSupported) { skipBuild("Static builds of QtWebEngine aren't supported.") return(false) } - !isPythonVersionSupported(): return(false) !isArchSupported(): return(false) isSanitizerEnabled():!isSanitizerSupported():!forceSanitizerBuild(): return(false) return(true) @@ -101,25 +100,6 @@ defineTest(isArchSupported) { return(false) } -defineTest(isPythonVersionSupported) { - python_error_msg = "Python version 2 (2.7.5 or later) is required to build Qt WebEngine." - python_version = $$system('python -c "import sys; print(sys.version_info[0:3])"') - python_version ~= s/[()]//g - python_version = $$split(python_version, ',') - python_major_version = $$first(python_version) - greaterThan(python_major_version, 2) { - skipBuild("Python version 3 is not supported by Chromium.") - skipBuild($$python_error_msg) - return(false) - } - python_minor_version = $$member(python_version, 1) - python_patch_version = $$member(python_version, 2) - greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): greaterThan(python_patch_version, 4): return(true) - skipBuild("Using Python version $${python_major_version}.$${python_minor_version}.$${python_patch_version}.") - skipBuild($$python_error_msg) - return(false) -} - defineTest(isSanitizerEnabled) { sanitize_address|sanitize_memory|sanitize_undefined|sanitize_thread: return(true) return(false) @@ -358,6 +338,25 @@ defineTest(use?) { return(false) } +# Returns the unquoted path to the python executable. +defineReplace(pythonPath) { + isEmpty(QMAKE_PYTHON2) { + # Fallback for building QtWebEngine with Qt < 5.8 + QMAKE_PYTHON2 = python + } + return($$QMAKE_PYTHON2) +} + +# Returns the python executable for use with shell / make targets. +defineReplace(pythonPathForShell) { + return($$shell_quote($$shell_path($$pythonPath()))) +} + +# Returns the python executable for use with $$system() +defineReplace(pythonPathForSystem) { + return($$system_quote($$system_path($$pythonPath()))) +} + defineReplace(ninjaPath) { src_3rd_party_dir = $$absolute_path("$${getChromiumSrcDir()}/../", "$$QTWEBENGINE_ROOT") out = $$shadowed($$absolute_path(ninja/ninja, $$src_3rd_party_dir)) |