diff options
author | Christophe Gouiran <bechris13250@gmail.com> | 2018-01-07 12:56:14 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-02-19 01:32:16 +0530 |
commit | 137ed6cf9da11a23084aeedfce1a5816b72d70ee (patch) | |
tree | c349e834f1c73a802c2676e86052c3e63761fdb7 | |
parent | 839a3360156cc78de473f4c9bcee0e8aefb15445 (diff) | |
download | meson-137ed6cf9da11a23084aeedfce1a5816b72d70ee.zip meson-137ed6cf9da11a23084aeedfce1a5816b72d70ee.tar.gz meson-137ed6cf9da11a23084aeedfce1a5816b72d70ee.tar.bz2 |
Change handling of not found external programs
-rw-r--r-- | mesonbuild/dependencies/__init__.py | 2 | ||||
-rw-r--r-- | mesonbuild/dependencies/base.py | 11 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py index 4dc2b27..69235da 100644 --- a/mesonbuild/dependencies/__init__.py +++ b/mesonbuild/dependencies/__init__.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 diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 0ef3372..b77c20e 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -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): diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 56aee5d..b848a69 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -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): |