diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2020-07-02 16:39:10 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-07-04 13:57:08 +0300 |
commit | f66c8c35dab22f547601a48217ee8a53be28e858 (patch) | |
tree | 8efde19c1b3460deb04cbbf61d1bdc4ae58cc348 /mesonbuild/dependencies/ui.py | |
parent | 92075f5ef3c5df3b5e6ec4ae5189e58acb2e7c3f (diff) | |
download | meson-f66c8c35dab22f547601a48217ee8a53be28e858.zip meson-f66c8c35dab22f547601a48217ee8a53be28e858.tar.gz meson-f66c8c35dab22f547601a48217ee8a53be28e858.tar.bz2 |
qt: Fix has_tools() when required=False
Improve logs by making it clear when the program is found but has
wrong version.
Diffstat (limited to 'mesonbuild/dependencies/ui.py')
-rw-r--r-- | mesonbuild/dependencies/ui.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index 3bba3dc..95dfe2b 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -229,11 +229,14 @@ class QtBaseDependency(ExternalDependency): bins = ['moc', 'uic', 'rcc', 'lrelease'] found = {b: NonExistingExternalProgram(name='{}-{}'.format(b, self.name)) for b in bins} + wanted = '== {}'.format(self.version) def gen_bins(): for b in bins: if self.bindir: yield os.path.join(self.bindir, b), b, False + # prefer the <tool>-qt<version> of the tool to the plain one, as we + # don't know what the unsuffixed one points to without calling it. yield '{}-{}'.format(b, self.name), b, False yield b, b, self.required if b != 'lrelease' else False @@ -241,12 +244,6 @@ class QtBaseDependency(ExternalDependency): if found[name].found(): continue - # prefer the <tool>-qt<version> of the tool to the plain one, as we - # don't know what the unsuffixed one points to without calling it. - p = interp_obj.find_program_impl([b], silent=True, required=required).held_object - if not p.found(): - continue - if name == 'lrelease': arg = ['-version'] elif mesonlib.version_compare(self.version, '>= 5'): @@ -255,12 +252,18 @@ class QtBaseDependency(ExternalDependency): arg = ['-v'] # Ensure that the version of qt and each tool are the same - _, out, err = mesonlib.Popen_safe(p.get_command() + arg) - if b.startswith('lrelease') or not self.version.startswith('4'): - care = out - else: - care = err - if mesonlib.version_compare(self.version, '== {}'.format(care.split(' ')[-1])): + def get_version(p): + _, out, err = mesonlib.Popen_safe(p.get_command() + arg) + if b.startswith('lrelease') or not self.version.startswith('4'): + care = out + else: + care = err + return care.split(' ')[-1].replace(')', '') + + p = interp_obj.find_program_impl([b], required=required, + version_func=get_version, + wanted=wanted).held_object + if p.found(): found[name] = p return tuple([found[b] for b in bins]) |