Consolidate raising a DependencyException() if required but not-found

This is now done by find_external_dependency() in all cases

I can't help but think this perhaps should be in a few more places...
pull/3657/head
Jon Turney 7 years ago
parent 01118ce2a4
commit 3576623b0f
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
  1. 13
      mesonbuild/dependencies/base.py
  2. 3
      mesonbuild/dependencies/misc.py
  3. 4
      mesonbuild/dependencies/ui.py

@ -392,8 +392,6 @@ class ConfigToolDependency(ExternalDependency):
mlog.log('Found', mlog.bold(self.tool_name), repr(req_version),
mlog.red('NO'))
mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.red('NO'))
if self.required:
raise DependencyException('Dependency {} not found'.format(self.name))
return False
mlog.log('Found {}:'.format(self.tool_name), mlog.bold(shutil.which(self.config)),
'({})'.format(version))
@ -475,9 +473,6 @@ class PkgConfigDependency(ExternalDependency):
'{!r}'.format(name, self.pkgbin.get_path()))
ret, self.version = self._call_pkgbin(['--modversion', name])
if ret != 0:
if self.required:
raise DependencyException('{} dependency {!r} not found'
''.format(self.type_string, name))
return
found_msg = [self.type_string + ' dependency', mlog.bold(name), 'found:']
if self.version_reqs is None:
@ -826,8 +821,6 @@ class DubDependency(ExternalDependency):
ret, res = self._call_dubbin(['describe', name])
if ret != 0:
if self.required:
raise DependencyException('Dependency {!r} not found'.format(name))
self.is_found = False
mlog.log('Dependency', mlog.bold(name), 'found:', mlog.red('NO'))
return
@ -840,8 +833,6 @@ class DubDependency(ExternalDependency):
msg = ['Dependency', mlog.bold(name), 'found but it was compiled with']
msg += [mlog.bold(j['compiler']), 'and we are using', mlog.bold(comp)]
mlog.error(*msg)
if self.required:
raise DependencyException('Dependency {!r} not found'.format(name))
self.is_found = False
mlog.log('Dependency', mlog.bold(name), 'found:', mlog.red('NO'))
return
@ -897,8 +888,6 @@ class DubDependency(ExternalDependency):
self.link_args.append(file)
if not found:
if self.required:
raise DependencyException('Dependency {!r} not found'.format(name))
self.is_found = False
mlog.log('Dependency', mlog.bold(name), 'found:', mlog.red('NO'))
return
@ -1249,8 +1238,6 @@ class ExtraFrameworkDependency(ExternalDependency):
self.name = d
self.is_found = True
return
if not self.found() and self.required:
raise DependencyException('Framework dependency %s not found.' % (name, ))
def get_version(self):
return 'unknown'

@ -38,7 +38,6 @@ class MPIDependency(ExternalDependency):
def __init__(self, environment, kwargs):
language = kwargs.get('language', 'c')
super().__init__('mpi', environment, language, kwargs)
required = kwargs.pop('required', True)
kwargs['required'] = False
kwargs['silent'] = True
self.is_found = False
@ -108,8 +107,6 @@ class MPIDependency(ExternalDependency):
mlog.log('Dependency', mlog.bold(self.name), 'for', self.language, 'found:', mlog.green('YES'), self.version)
else:
mlog.log('Dependency', mlog.bold(self.name), 'for', self.language, 'found:', mlog.red('NO'))
if required:
raise DependencyException('MPI dependency {!r} not found'.format(self.name))
def _filter_compile_args(self, args):
"""

@ -227,10 +227,6 @@ class QtBaseDependency(ExternalDependency):
self.link_args = []
from_text = '(checked {})'.format(mlog.format_list(methods))
self.version = 'none'
if self.required:
err_msg = '{} {} dependency not found {}' \
''.format(self.qtname, type_text, from_text)
raise DependencyException(err_msg)
if not self.silent:
mlog.log(found_msg.format(from_text), mlog.red('NO'))
return

Loading…
Cancel
Save