diff options
author | Kai Koehne <[email protected]> | 2020-05-07 10:35:35 +0200 |
---|---|---|
committer | Kai Koehne <[email protected]> | 2020-05-07 13:45:03 +0200 |
commit | 2b41025fc967b37c8bff77c4b75bab333ae13f46 (patch) | |
tree | ff6509b9a8a6b15819a5504db41314683449c357 | |
parent | adfff7ec77223dfdd8c29327dc0f0181972516ef (diff) |
Port python check to configure system
Also check for py, python2, python3 executables.
Task-number: QTBUG-72926
Fixes: QTBUG-84038
Pick-to: 5.15
Change-Id: I844db4dd630d9b3025eca529ee57565b600ebbac
Reviewed-by: Joerg Bornemann <[email protected]>
-rw-r--r-- | qtdeclarative.pro | 8 | ||||
-rw-r--r-- | src/3rdparty/masm/masm.pri | 4 | ||||
-rw-r--r-- | src/qml/configure.json | 21 | ||||
-rw-r--r-- | src/qml/configure.pri | 22 | ||||
-rw-r--r-- | src/qml/qml.pro | 6 |
5 files changed, 50 insertions, 11 deletions
diff --git a/qtdeclarative.pro b/qtdeclarative.pro index 84120bfd07..f76f8a7587 100644 --- a/qtdeclarative.pro +++ b/qtdeclarative.pro @@ -5,11 +5,3 @@ requires(qtConfig(commandlineparser)) requires(qtConfig(temporaryfile)) load(qt_parts) - -!python_available { - py_out = $$system('python -c "print(1)"') - !equals(py_out, 1): error("Building QtQml requires Python.") - tmp = python_available - CONFIG += $$tmp - cache(CONFIG, add, tmp) -} diff --git a/src/3rdparty/masm/masm.pri b/src/3rdparty/masm/masm.pri index 1df4585aae..9a12e65eeb 100644 --- a/src/3rdparty/masm/masm.pri +++ b/src/3rdparty/masm/masm.pri @@ -58,7 +58,7 @@ contains(DEFINES, WTF_USE_UDIS86=1) { udis86.output = udis86_itab.h udis86.input = ITAB udis86.CONFIG += no_link - udis86.commands = python $$PWD/disassembler/udis86/itab.py ${QMAKE_FILE_IN} + udis86.commands = $QMAKE_PYTHON $$PWD/disassembler/udis86/itab.py ${QMAKE_FILE_IN} QMAKE_EXTRA_COMPILERS += udis86 udis86_tab_cfile.target = $$OUT_PWD/udis86_itab.c @@ -111,7 +111,7 @@ retgen.output = $$GENERATEDDIR/RegExpJitTables.h retgen.script = $$PWD/yarr/create_regex_tables retgen.input = retgen.script retgen.CONFIG += no_link -retgen.commands = python $$retgen.script > ${QMAKE_FILE_OUT} +retgen.commands = $$QMAKE_PYTHON $$retgen.script > ${QMAKE_FILE_OUT} QMAKE_EXTRA_COMPILERS += retgen # Taken from WebKit/Tools/qmake/mkspecs/features/unix/default_post.prf diff --git a/src/qml/configure.json b/src/qml/configure.json index 3fc1fd528b..944358bc48 100644 --- a/src/qml/configure.json +++ b/src/qml/configure.json @@ -69,6 +69,11 @@ "#endif" ] } + }, + "qml-python": { + "label": "python", + "type": "detectPython", + "log": "location" } }, @@ -185,9 +190,25 @@ "section": "QML", "condition": "features.itemmodel", "output": [ "privateFeature" ] + }, + "qml-python": { + "label": "python", + "condition": "tests.qml-python", + "output": [ + "privateFeature", + { "type": "varAssign", "name": "QMAKE_PYTHON", "value": "tests.qml-python.location" } + ] } }, + "report": [ + { + "type": "error", + "condition": "!features.qml-python", + "message": "Python is required to build QtQml." + } + ], + "summary": [ { "section": "Qt QML", diff --git a/src/qml/configure.pri b/src/qml/configure.pri new file mode 100644 index 0000000000..2ab5f9454d --- /dev/null +++ b/src/qml/configure.pri @@ -0,0 +1,22 @@ +equals(QMAKE_HOST.os, Windows): EXE_SUFFIX = .exe + +defineTest(qtConfTest_detectPython) { + PYTHON_NAMES = python$$EXE_SUFFIX python2$${EXE_SUFFIX} python3$${EXE_SUFFIX} py$${EXE_SUFFIX} + for (name, PYTHON_NAMES) { + python_path = $$qtConfFindInPath("$$name") + !isEmpty(python_path): \ + break() + } + isEmpty(python_path) { + qtLog("No $$PYTHON_NAMES are found in PATH. Giving up.") + return(false) + } + + # Make tests.python.location available in configure.json. + $${1}.location = $$clean_path($$python_path) + export($${1}.location) + $${1}.cache += location + export($${1}.cache) + + return(true) +} diff --git a/src/qml/qml.pro b/src/qml/qml.pro index 7bb3547ee9..14b46307aa 100644 --- a/src/qml/qml.pro +++ b/src/qml/qml.pro @@ -7,6 +7,9 @@ qtConfig(qml-network): \ TRACEPOINT_PROVIDER = $$PWD/qtqml.tracepoints CONFIG += qt_tracepoints +!qtConfig(qml-python): \ + error(Python is required to build QtQml.) + DEFINES += QT_NO_URL_CAST_FROM_STRING QT_NO_INTEGER_EVENT_COORDINATES msvc:equals(QT_ARCH, i386): QMAKE_LFLAGS += /BASE:0x66000000 @@ -63,7 +66,6 @@ qtConfig(qml-animation) { } include(types/types.pri) include(../3rdparty/masm/masm-defs.pri) -include(../3rdparty/masm/masm.pri) MODULE_PLUGIN_TYPES = \ qmltooling @@ -75,3 +77,5 @@ QML_IMPORT_VERSION = $$QT_VERSION CONFIG += qmltypes install_qmltypes install_metatypes load(qt_module) + +include(../3rdparty/masm/masm.pri) |