aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-06-15 10:25:25 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-06-17 06:56:48 +0200
commit8e731da36ee8616f2da005f19c7a6c8c02665118 (patch)
treee55f2d21495816db6403e30fc3f8ff2e40032745 /build_scripts
parent099d6c09f704a6f8ace929e5522c5fd655e14215 (diff)
Introduce qtpaths as qmake replacement
qtpaths has become the recommended tool for querying Qt properties (see qtbase/fef850c51a069ed89ba400e6ffccbbea4b0cbb9f). Deprecate the --qmake option in favor of it and use qtpaths for the values. qmake is only used if a path is given on the command line. [ChangeLog][PySide6] qtpaths is now used to query Qt properties. Task-number: QTBUG-75870 Change-Id: I9a29b05d8b6e982647eeeeeda0134ddc807da141 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'build_scripts')
-rw-r--r--build_scripts/main.py4
-rw-r--r--build_scripts/options.py27
-rw-r--r--build_scripts/qtinfo.py29
3 files changed, 53 insertions, 7 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index 9e898987d..ed1c42f32 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -500,7 +500,9 @@ class PysideBuild(_build, DistUtilsCommandMixin):
self.py_scripts_dir = py_scripts_dir
self.qtinfo = QtInfo()
- qt_dir = os.path.dirname(OPTION["QMAKE"])
+ qt_dir = os.path.dirname(OPTION["QTPATHS"])
+ if OPTION['HAS_QMAKE_OPTION']:
+ qt_dir = os.path.dirname(OPTION["QMAKE"])
qt_version = get_qt_version()
# Update the PATH environment variable
diff --git a/build_scripts/options.py b/build_scripts/options.py
index 1e32d5e92..58673c1ea 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -206,7 +206,8 @@ class DistUtilsCommandMixin(object):
('sanitize-address', None, 'Build with address sanitizer'),
('shorter-paths', None, 'Use shorter paths'),
('doc-build-online', None, 'Build online documentation'),
- ('qmake=', None, 'Path to qmake'),
+ ('qtpaths=', None, 'Path to qtpaths'),
+ ('qmake=', None, 'Path to qmake (deprecated, use qtpaths)'),
('qt=', None, 'Qt version'),
('cmake=', None, 'Path to CMake'),
('openssl=', None, 'Path to OpenSSL libraries'),
@@ -245,7 +246,9 @@ class DistUtilsCommandMixin(object):
self.snapshot_build = False
self.shorter_paths = False
self.doc_build_online = False
+ self.qtpaths = None
self.qmake = None
+ self.has_qmake_option = False
self.qt = '5'
self.cmake = None
self.openssl = None
@@ -294,11 +297,18 @@ class DistUtilsCommandMixin(object):
OPTION['SANITIZE_ADDRESS'] = self.sanitize_address
OPTION['SHORTER_PATHS'] = self.shorter_paths
OPTION['DOC_BUILD_ONLINE'] = self.doc_build_online
+
+ qtpaths_abs_path = os.path.abspath(self.qtpaths)
+ OPTION['QTPATHS'] = qtpaths_abs_path
+ # FIXME PYSIDE7: Remove qmake handling
# make qtinfo.py independent of relative paths.
qmake_abs_path = os.path.abspath(self.qmake)
OPTION['QMAKE'] = qmake_abs_path
+ OPTION['HAS_QMAKE_OPTION'] = self.has_qmake_option
OPTION['QT_VERSION'] = self.qt
- QtInfo().setup(self.cmake, qmake_abs_path)
+ QtInfo().setup(qtpaths_abs_path, self.cmake, qmake_abs_path,
+ self.has_qmake_option)
+
OPTION['CMAKE'] = os.path.abspath(self.cmake)
OPTION['OPENSSL'] = self.openssl
OPTION['SHIBOKEN_CONFIG_DIR'] = self.shiboken_config_dir
@@ -324,7 +334,18 @@ class DistUtilsCommandMixin(object):
log.error(f"'{self.cmake}' does not exist.")
return False
- if not self.qmake:
+ if not self.qtpaths:
+ self.qtpaths = find_executable("qtpaths")
+ if not self.qtpaths:
+ log.error("qtpaths could not be found.")
+ return False
+ if not os.path.exists(self.qtpaths):
+ log.error(f"'{self.qtpaths}' does not exist.")
+ return False
+
+ if self.qmake:
+ self.has_qmake_option = True
+ else:
self.qmake = find_executable("qmake")
if not self.qmake:
self.qmake = find_executable("qmake-qt5")
diff --git a/build_scripts/qtinfo.py b/build_scripts/qtinfo.py
index 61483a83c..024ab0c16 100644
--- a/build_scripts/qtinfo.py
+++ b/build_scripts/qtinfo.py
@@ -79,14 +79,18 @@ class QtInfo(object):
class __QtInfo: # Python singleton
def __init__(self):
+ self._qtpaths_command = None
self._cmake_command = None
self._qmake_command = None
+ self._force_qmake = False
# Dict to cache qmake values.
self._query_dict = {}
- def setup(self, cmake, qmake):
+ def setup(self, qtpaths, cmake, qmake, force_qmake):
+ self._qtpaths_command = qtpaths
self._cmake_command = cmake
self._qmake_command = qmake
+ self._force_qmake = force_qmake
@property
def qmake_command(self):
@@ -164,6 +168,19 @@ class QtInfo(object):
return None
return self._query_dict[prop_name]
+ def _get_qtpaths_output(self, args_list=[], cwd=None):
+ assert self._qtpaths_command
+ cmd = [self._qtpaths_command]
+ cmd.extend(args_list)
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=False,
+ cwd=cwd, universal_newlines=True)
+ output, error = proc.communicate()
+ proc.wait()
+ if proc.returncode != 0:
+ raise RuntimeError(f"Could not run {self._qtpaths_command}: {error}")
+ return output
+
+ # FIXME PYSIDE7: Remove qmake handling
def _get_qmake_output(self, args_list=[], cwd=None):
assert self._qmake_command
cmd = [self._qmake_command]
@@ -189,14 +206,20 @@ class QtInfo(object):
return props
def _get_query_properties(self):
- output = self._get_qmake_output(["-query"])
+ if self._force_qmake:
+ output = self._get_qmake_output(["-query"])
+ else:
+ output = self._get_qtpaths_output(["--qt-query"])
self._query_dict = self._parse_query_properties(output)
def _get_other_properties(self):
# Get the src property separately, because it is not returned by
# qmake unless explicitly specified.
key = "QT_INSTALL_PREFIX/src"
- result = self._get_qmake_output(["-query", key])
+ if self._force_qmake:
+ result = self._get_qmake_output(["-query", key])
+ else:
+ result = self._get_qtpaths_output(["--qt-query", key])
self._query_dict[key] = result
# Get mkspecs variables and cache them.