From 6cfd2b4d5bd30b372268c25308b1cb00afd0996d Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 31 Aug 2023 14:13:50 +0530 Subject: Override config-tool get_variable args for qmake --- mesonbuild/dependencies/configtool.py | 5 ++++- mesonbuild/dependencies/qt.py | 3 +++ test cases/frameworks/4 qt/meson.build | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mesonbuild/dependencies/configtool.py b/mesonbuild/dependencies/configtool.py index 5a4294e..8dda298 100644 --- a/mesonbuild/dependencies/configtool.py +++ b/mesonbuild/dependencies/configtool.py @@ -150,8 +150,11 @@ class ConfigToolDependency(ExternalDependency): return [] return split_args(out) + def get_variable_args(self, variable_name: str) -> T.List[str]: + return [f'--{variable_name}'] + def get_configtool_variable(self, variable_name: str) -> str: - p, out, _ = Popen_safe(self.config + [f'--{variable_name}']) + p, out, _ = Popen_safe(self.config + self.get_variable_args(variable_name)) if p.returncode != 0: if self.required: raise DependencyException( diff --git a/mesonbuild/dependencies/qt.py b/mesonbuild/dependencies/qt.py index 1a86bd2..ceb0321 100644 --- a/mesonbuild/dependencies/qt.py +++ b/mesonbuild/dependencies/qt.py @@ -350,6 +350,9 @@ class QmakeQtDependency(_QtBase, ConfigToolDependency, metaclass=abc.ABCMeta): return m.group(0).rstrip('.') return version + def get_variable_args(self, variable_name: str) -> T.List[str]: + return ['-query', f'{variable_name}'] + @abc.abstractmethod def get_private_includes(self, mod_inc_dir: str, module: str) -> T.List[str]: pass diff --git a/test cases/frameworks/4 qt/meson.build b/test cases/frameworks/4 qt/meson.build index 04a5288..f8ba175 100644 --- a/test cases/frameworks/4 qt/meson.build +++ b/test cases/frameworks/4 qt/meson.build @@ -50,6 +50,9 @@ foreach qt : ['qt4', 'qt5', 'qt6'] qtmodule = import(qt) assert(qtmodule.has_tools()) + # Test that fetching a variable works and yields a non-empty value + assert(qtdep.get_variable('prefix', configtool: 'QT_INSTALL_PREFIX') != '') + # The following has two resource files because having two in one target # requires you to do it properly or you get linker symbol clashes. -- cgit v1.1