aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2022-07-05 11:52:59 +0200
committerDominik Holland <dominik.holland@qt.io>2022-07-06 16:19:54 +0200
commit0138c1b1fd797c275198f303a37dbe356916dc27 (patch)
treee34f5aa180b60c56e0740f0de3ef5e87ce7f5f22
parentf6802b29a9497bc1f76c508aa80344ded7b29af7 (diff)
ivigenerator: Add a fallback mechanism for too recent python packages
After the virtualenv is created the generator is now verified to be working correctly. In case the generator doesn't work, an error message is shown, which suggests to reconfigure with -config qtivi_use_minimal_qface_packages The new option will install the minimum required dependencies for qface. This is a cherry-pick of 8538f97aab223e5407dcb1183b7fb468a9b800a1 from the qtinterfaceframework repository. Fixes: QTBUG-102348 Change-Id: If7f3ba3bd39ea5bae89bbde3c704c78713adcd68 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
m---------src/3rdparty/qface0
-rw-r--r--src/tools/ivigenerator/qface_internal_build.pri27
-rwxr-xr-xsrc/tools/ivigenerator/verify_generator.py55
3 files changed, 79 insertions, 3 deletions
diff --git a/src/3rdparty/qface b/src/3rdparty/qface
-Subproject 7b5f67f7348683898f447c9057f7ffc54ea6077
+Subproject 2459064b0ca85c5fb19cc2a83cc2110be6da4a0
diff --git a/src/tools/ivigenerator/qface_internal_build.pri b/src/tools/ivigenerator/qface_internal_build.pri
index 361390c..a0e3551 100644
--- a/src/tools/ivigenerator/qface_internal_build.pri
+++ b/src/tools/ivigenerator/qface_internal_build.pri
@@ -63,10 +63,18 @@ write_file($$OUT_PWD/forceRebuild)
PYTHON3_SHORT_VERSION_SPLITTED = $$split(QMAKE_PYTHON3_VERSION, .)
PYTHON3_SHORT_VERSION = $$member(PYTHON3_SHORT_VERSION_SPLITTED, 0).$$member(PYTHON3_SHORT_VERSION_SPLITTED, 1)
+# If the upstream python packages introduce a regression this option can be used to install
+# the minimum version for all required python package and produce a working setup
+# Those packages might be outdated and may contain security holes, but they are known to be
+# working.
+qtivi_use_minimal_qface_packages {
+ PIP3_INSTALL_COMMAND = pip3 install --upgrade -r $$system_path($$QFACE_SOURCE_DIR/requirements_minimal.txt) &&
+}
+
# On the CI we use the special wheel folder when available to not download all packages again on each build
PYTHON3_WHEEL_CACHE=$$(PYTHON3_WHEEL_CACHE)
-!isEmpty(PYTHON3_WHEEL_CACHE): PIP3_INSTALL_COMMAND = pip3 install --no-index --find-links=$$system_path($$PYTHON3_WHEEL_CACHE) $$system_path($$QFACE_SOURCE_DIR) --verbose
-else: PIP3_INSTALL_COMMAND = pip3 install --upgrade $$system_path($$QFACE_SOURCE_DIR)
+!isEmpty(PYTHON3_WHEEL_CACHE): PIP3_INSTALL_COMMAND += pip3 install --no-index --find-links=$$system_path($$PYTHON3_WHEEL_CACHE) $$system_path($$QFACE_SOURCE_DIR) --verbose
+else: PIP3_INSTALL_COMMAND += pip3 install --upgrade $$system_path($$QFACE_SOURCE_DIR)
# Always run this target
equals(QMAKE_HOST.os, Windows): qtivi_qface_install.target = qtivi_qface_virtualenv/Lib/site-packages/qface
@@ -94,7 +102,20 @@ equals(QMAKE_HOST.os, Windows) {
}
deploy_virtualenv.depends = $${qtivi_qface_install.target}
QMAKE_EXTRA_TARGETS += deploy_virtualenv
-PRE_TARGETDEPS += $${deploy_virtualenv.target}
+
+# We need to make the virtualenv first deployable
+# Otherwise it still needs some modules from the system
+verify_virtualenv.target = .stamp-verify_virtualenv
+equals(QMAKE_HOST.os, Windows) {
+ verify_virtualenv.commands = $$system_path(qtivi_qface_virtualenv/Scripts/python.exe) $$PWD/verify_generator.py $$escape_expand(\n\t)
+ verify_virtualenv.commands += @type nul > $$system_path($$OUT_PWD/.stamp-verify_virtualenv)
+} else {
+ verify_virtualenv.commands = $$system_path(qtivi_qface_virtualenv/bin/python) $$PWD/verify_generator.py $$escape_expand(\n\t)
+ verify_virtualenv.commands += @touch $$OUT_PWD/.stamp-verify_virtualenv
+}
+verify_virtualenv.depends = $${deploy_virtualenv.target}
+QMAKE_EXTRA_TARGETS += verify_virtualenv
+PRE_TARGETDEPS += $${verify_virtualenv.target}
virtualenv.files = $$OUT_PWD/qtivi_qface_virtualenv
virtualenv.path = $$[QT_HOST_BINS]/ivigenerator
diff --git a/src/tools/ivigenerator/verify_generator.py b/src/tools/ivigenerator/verify_generator.py
new file mode 100755
index 0000000..cd808a3
--- /dev/null
+++ b/src/tools/ivigenerator/verify_generator.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+# Copyright (C) 2022 The Qt Company Ltd.
+# Contact: https://www.qt.io/licensing/
+#
+# This file is part of the QtIvi module of the Qt Toolkit.
+#
+# $QT_BEGIN_LICENSE:LGPL-QTAS$
+# Commercial License Usage
+# Licensees holding valid commercial Qt Automotive Suite licenses may use
+# this file in accordance with the commercial license agreement provided
+# with the Software or, alternatively, in accordance with the terms
+# contained in a written agreement between you and The Qt Company. For
+# licensing terms and conditions see https://www.qt.io/terms-conditions.
+# For further information use the contact form at https://www.qt.io/contact-us.
+#
+# GNU Lesser General Public License Usage
+# Alternatively, this file may be used under the terms of the GNU Lesser
+# General Public License version 3 as published by the Free Software
+# Foundation and appearing in the file LICENSE.LGPL3 included in the
+# packaging of this file. Please review the following information to
+# ensure the GNU Lesser General Public License version 3 requirements
+# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+#
+# GNU General Public License Usage
+# Alternatively, this file may be used under the terms of the GNU
+# General Public License version 2.0 or (at your option) the GNU General
+# Public license version 3 or any later version approved by the KDE Free
+# Qt Foundation. The licenses are as published by the Free Software
+# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+# included in the packaging of this file. Please review the following
+# information to ensure the GNU General Public License requirements will
+# be met: https://www.gnu.org/licenses/gpl-2.0.html and
+# https://www.gnu.org/licenses/gpl-3.0.html.
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: LGPL-3.0
+
+try:
+ import generate
+except Exception as e:
+ raise SystemExit("""
+ Verifying the generator failed!
+
+ This might be caused by a too recent python version or
+ too recent python packages. You can try installing older
+ python packages by running configure again with the the
+ following option:
+
+ -config qtivi_use_minimal_qface_packages
+
+ The python error was:
+
+ {}
+ """.format(e))