Change handling of not found external programs

0.44
Christophe Gouiran 7 years ago committed by Nirbheek Chauhan
parent 839a336015
commit 137ed6cf9d
  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

@ -753,6 +753,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):

@ -2119,7 +2119,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