Change handling of not found external programs

pull/2617/merge
Christophe Gouiran 7 years ago committed by Jussi Pakkanen
parent dfd368d405
commit 81100f0695
  1. 2
      mesonbuild/dependencies/__init__.py
  2. 11
      mesonbuild/dependencies/base.py
  3. 2
      mesonbuild/interpreter.py

@ -13,7 +13,7 @@
# limitations under the License.
from .base import ( # noqa: F401
Dependency, DependencyException, DependencyMethods, ExternalProgram,
Dependency, DependencyException, DependencyMethods, ExternalProgram, NonExistingExternalProgram,
ExternalDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency,
PkgConfigDependency, find_external_dependency, get_dep_identifier, packages, _packages_accept_language)
from .dev import GMockDependency, GTestDependency, LLVMDependency, ValgrindDependency

@ -765,6 +765,17 @@ class ExternalProgram:
def get_name(self):
return self.name
class NonExistingExternalProgram(ExternalProgram):
def __init__(self):
super().__init__(name = 'nonexistingprogram', silent = True)
def __repr__(self):
r = '<{} {!r} -> {!r}>'
return r.format(self.__class__.__name__, self.name, self.command)
def found(self):
return False
class ExternalLibrary(ExternalDependency):
def __init__(self, name, link_args, environment, language, silent=False):

@ -2123,7 +2123,7 @@ to directly access options of other subprojects.''')
if required and (progobj is None or not progobj.found()):
raise InvalidArguments('Program "%s" not found or not executable' % args[0])
if progobj is None:
return ExternalProgramHolder(dependencies.ExternalProgram('nonexistingprogram'))
return ExternalProgramHolder(dependencies.NonExistingExternalProgram())
return progobj
def func_find_library(self, node, args, kwargs):

Loading…
Cancel
Save