diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2024-01-22 17:02:21 +0100 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2024-03-25 11:25:13 +0100 |
commit | 2294cc4ed5fdbaec93792f4f6094a68e2e6a9a8c (patch) | |
tree | 33edf03d0dc19c1963273a3c1ca88a442e2ee41a | |
parent | 71dd46b3790e8b1b1dec40f65aff94ddb467e444 (diff) |
Add option to chose python version for building 5.15 WebEngine
[ChangeLog] Adds the configure option --webengine-python-version to
allow the user to select the python version for building.
Valid options are python2 or python3. The default version will continue
to be Python 2.
Fixes: QTBUG-117693
Change-Id: Ie12ce78d1d81c49a2c46acc4160c13f766d56fe7
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | config_help.txt | 1 | ||||
-rw-r--r-- | configure.pri | 37 | ||||
-rw-r--r-- | mkspecs/features/functions.prf | 6 | ||||
m--------- | src/3rdparty | 0 | ||||
-rw-r--r-- | src/buildtools/config/support.pri | 10 | ||||
-rw-r--r-- | src/buildtools/configure.json | 21 |
6 files changed, 45 insertions, 30 deletions
diff --git a/config_help.txt b/config_help.txt index 48236c18a..d50892121 100644 --- a/config_help.txt +++ b/config_help.txt @@ -15,6 +15,7 @@ WebEngine options: (Linux only) -webengine-pepper-plugins ...... Enable use of Pepper Flash and Widevine plugins [auto] + -webengine-python-version ...... Use specific python version for building [python2/python3] -webengine-printing-and-pdf .... Enable use of printing and output to PDF [auto] -webengine-proprietary-codecs .. Enable support for proprietary codecs [no] diff --git a/configure.pri b/configure.pri index 3a33bdc82..99cdbf72b 100644 --- a/configure.pri +++ b/configure.pri @@ -12,12 +12,9 @@ defineTest(isPythonVersionSupported) { python_version ~= s/[()]//g python_version = $$split(python_version, ',') python_major_version = $$first(python_version) - greaterThan(python_major_version, 2) { - qtLog("Python version 3 is not supported by Chromium.") - return(false) - } python_minor_version = $$member(python_version, 1) python_patch_version = $$member(python_version, 2) + greaterThan(python_major_version, 2): greaterThan(python_minor_version, 7): return(true) greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): greaterThan(python_patch_version, 4): return(true) qtLog("Unsupported python version: $${python_major_version}.$${python_minor_version}.$${python_patch_version}.") return(false) @@ -52,22 +49,38 @@ defineTest(qtConfReport_jumboBuild) { qtConfReportPadded($${1}, $$mergeLimit) } -defineTest(qtConfTest_detectPython2) { - python = $$qtConfFindInPath("python2$$EXE_SUFFIX") - isEmpty(python) { - qtLog("'python2$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.") - python = $$qtConfFindInPath("python$$EXE_SUFFIX") +defineTest(qtConfTest_detectPython) { + pythonOverride = $$eval(config.input.python_override) + !isEmpty(pythonOverride) { + python = $$qtConfFindInPath("$$pythonOverride$$EXE_SUFFIX") + isEmpty(python) { + qtLog("User selected '$$pythonOverride$$EXE_SUFFIX' was not found in PATH. Giving up.") + return(false) + } } + + win32 { + # the default name of the python 2 executable on windows is just + # python, so try that first + isEmpty(python):python = $$qtConfFindInPath("python$$EXE_SUFFIX") + isEmpty(python):python = $$qtConfFindInPath("python2$$EXE_SUFFIX") + isEmpty(python):python = $$qtConfFindInPath("python3$$EXE_SUFFIX") + } else { + isEmpty(python):python = $$qtConfFindInPath("python2$$EXE_SUFFIX") + isEmpty(python):python = $$qtConfFindInPath("python3$$EXE_SUFFIX") + isEmpty(python):python = $$qtConfFindInPath("python$$EXE_SUFFIX") + } + isEmpty(python) { - qtLog("'python$$EXE_SUFFIX' not found in PATH. Giving up.") + qtLog("Python not found in PATH. Giving up.") return(false) } !isPythonVersionSupported($$python) { - qtLog("A suitable Python 2 executable could not be located.") + qtLog("A suitable Python executable could not be located.") return(false) } - # Make tests.python2.location available in configure.json. + # Make tests.python.location available in configure.json. $${1}.location = $$clean_path($$python) export($${1}.location) $${1}.cache += location diff --git a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf index 7f630588a..65500776b 100644 --- a/mkspecs/features/functions.prf +++ b/mkspecs/features/functions.prf @@ -44,11 +44,11 @@ defineReplace(which) { # Returns the unquoted path to the python executable. defineReplace(pythonPath) { - isEmpty(QMAKE_PYTHON2) { + isEmpty(QMAKE_PYTHON) { # Fallback for building QtWebEngine with Qt < 5.8 - QMAKE_PYTHON2 = python + QMAKE_PYTHON = python } - return($$QMAKE_PYTHON2) + return($$QMAKE_PYTHON) } # Returns the python executable for use with shell / make targets. diff --git a/src/3rdparty b/src/3rdparty -Subproject 38655f07d8ef13eb067e3a29bb3a0c2dc0b1971 +Subproject 68302c9ea158fbc83cd28570a0560e5a892b45e diff --git a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri index e7f869a15..a9df3d243 100644 --- a/src/buildtools/config/support.pri +++ b/src/buildtools/config/support.pri @@ -21,7 +21,7 @@ defineReplace(qtwebengine_checkWebEngineCoreError) { !qtwebengine_checkForGperf(QtWebEngine):return(false) !qtwebengine_checkForBison(QtWebEngine):return(false) !qtwebengine_checkForFlex(QtWebEngine):return(false) - !qtwebengine_checkForPython2(QtWebEngine):return(false) + !qtwebengine_checkForPython(QtWebEngine):return(false) !qtwebengine_checkForNodejs(QtWebEngine):return(false) !qtwebengine_checkForSanitizer(QtWebEngine):return(false) linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false) @@ -51,7 +51,7 @@ defineReplace(qtwebengine_checkPdfError) { !qtwebengine_checkForGperf(QtPdf):return(false) !qtwebengine_checkForBison(QtPdf):return(false) !qtwebengine_checkForFlex(QtPdf):return(false) - !qtwebengine_checkForPython2(QtPdf):return(false) + !qtwebengine_checkForPython(QtPdf):return(false) !qtwebengine_checkForSanitizer(QtPdf):return(false) linux:!qtwebengine_checkForPkgCfg(QtPdf):return(false) linux:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false) @@ -143,10 +143,10 @@ defineTest(qtwebengine_checkForFlex) { return(true) } -defineTest(qtwebengine_checkForPython2) { +defineTest(qtwebengine_checkForPython) { module = $$1 - !qtConfig(webengine-python2) { - qtwebengine_skipBuild("Python version 2 (2.7.5 or later) is required to build $${module}.") + !qtConfig(webengine-python) { + qtwebengine_skipBuild("Python version 2 (2.7.5 or later) or Python version 3 (3.6 or later) is required to build $${module}.") return(false) } return(true) diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json index 9e7a0c570..17fc65106 100644 --- a/src/buildtools/configure.json +++ b/src/buildtools/configure.json @@ -10,7 +10,8 @@ "options": { "build-qtwebengine-core": "boolean", "build-qtpdf": "boolean", - "webengine-jumbo-build": { "type": "optionalString", "name": "merge_limit"} + "webengine-jumbo-build": { "type": "optionalString", "name": "merge_limit"}, + "webengine-python-version": { "type": "optionalString", "name": "python_override", "values": ["python2", "python3"] } } }, "libraries": { @@ -316,9 +317,9 @@ "label": "system ninja", "type": "detectNinja" }, - "webengine-python2": { - "label": "python2", - "type": "detectPython2", + "webengine-python": { + "label": "python", + "type": "detectPython", "log": "location" }, "webengine-winversion": { @@ -395,7 +396,7 @@ && features.webengine-gperf && features.webengine-bison && features.webengine-flex - && features.webengine-python2 + && features.webengine-python && features.webengine-nodejs && (!config.sanitizer || features.webengine-sanitizer) && (!config.linux || features.pkg-config) @@ -421,7 +422,7 @@ && features.webengine-gperf && features.webengine-bison && features.webengine-flex - && features.webengine-python2 + && features.webengine-python && (!config.sanitizer || features.webengine-sanitizer) && (!config.linux || features.pkg-config) && (!config.linux || features.webengine-host-pkg-config) @@ -444,12 +445,12 @@ "autoDetect": "features.private_tests", "output": [ "privateFeature" ] }, - "webengine-python2": { - "label": "python2", - "condition": "tests.webengine-python2", + "webengine-python": { + "label": "python", + "condition": "tests.webengine-python", "output": [ "privateFeature", - { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" } + { "type": "varAssign", "name": "QMAKE_PYTHON", "value": "tests.webengine-python.location" } ] }, "webengine-gperf": { |