aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-05-07 10:35:35 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-05-18 18:37:29 +0200
commit1c6a70e1880a8fe0f3d8da4932c4f3533693219c (patch)
tree34bf768b98af5beaf21008fe2a92e5ec37535660
parent73ab6292cd514fb188f0ba38654709f33bba4946 (diff)
Port python check to configure system
Also check for py, python2, python3 executables. Task-number: QTBUG-72926 Fixes: QTBUG-84038 Change-Id: I844db4dd630d9b3025eca529ee57565b600ebbac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 2b41025fc967b37c8bff77c4b75bab333ae13f46) Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--qtdeclarative.pro8
-rw-r--r--src/3rdparty/masm/masm.pri4
-rw-r--r--src/qml/configure.json21
-rw-r--r--src/qml/configure.pri22
-rw-r--r--src/qml/qml.pro6
5 files changed, 50 insertions, 11 deletions
diff --git a/qtdeclarative.pro b/qtdeclarative.pro
index 5b94da9b69..e924331929 100644
--- a/qtdeclarative.pro
+++ b/qtdeclarative.pro
@@ -1,10 +1,2 @@
CONFIG += tests_need_tools examples_need_tools
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 e39a8319b6..7d5a92ad92 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 @@ IMPORT_VERSION = 2.$$QT_MINOR_VERSION
CONFIG += qmltypes install_qmltypes install_metatypes
load(qt_module)
+
+include(../3rdparty/masm/masm.pri)