aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-04-12 02:41:33 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2018-04-21 16:10:03 +0300
commitfc5e8dfcdae11d23469fd01d878c7c9c30d67d30 (patch)
treeee863f6d18e0d95fa08d042647613a2ff9842fc2 /mesonbuild
parent2993eaf8844cfc04800ac22ab4012c8ee6f87b0e (diff)
downloadmeson-fc5e8dfcdae11d23469fd01d878c7c9c30d67d30.zip
meson-fc5e8dfcdae11d23469fd01d878c7c9c30d67d30.tar.gz
meson-fc5e8dfcdae11d23469fd01d878c7c9c30d67d30.tar.bz2
Don't fail on not-required not-found deps in forcefallback mode
This involves the creation of a new dummy NotFoundDependency.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/__init__.py2
-rw-r--r--mesonbuild/dependencies/base.py8
-rw-r--r--mesonbuild/interpreter.py10
3 files changed, 14 insertions, 6 deletions
diff --git a/mesonbuild/dependencies/__init__.py b/mesonbuild/dependencies/__init__.py
index 1c67311..5259c5b 100644
--- a/mesonbuild/dependencies/__init__.py
+++ b/mesonbuild/dependencies/__init__.py
@@ -15,7 +15,7 @@
from .boost import BoostDependency
from .base import ( # noqa: F401
Dependency, DependencyException, DependencyMethods, ExternalProgram, NonExistingExternalProgram,
- ExternalDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency,
+ ExternalDependency, NotFoundDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency,
PkgConfigDependency, find_external_dependency, get_dep_identifier, packages, _packages_accept_language)
from .dev import GMockDependency, GTestDependency, LLVMDependency, ValgrindDependency
from .misc import (MPIDependency, OpenMPDependency, Python3Dependency, ThreadDependency, PcapDependency, CupsDependency, LibWmfDependency)
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 27a5fcb..0114a14 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -257,6 +257,14 @@ class ExternalDependency(Dependency):
return new
+class NotFoundDependency(Dependency):
+ def __init__(self, environment):
+ super().__init__('not-found', {})
+ self.env = environment
+ self.name = 'not-found'
+ self.is_found = False
+
+
class ConfigToolDependency(ExternalDependency):
"""Class representing dependencies found using a config tool."""
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index b119b3d..fc97b62 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -23,7 +23,7 @@ from .wrap import wrap, WrapMode
from . import mesonlib
from .mesonlib import FileMode, Popen_safe, listify, extract_as_list, has_path_sep
from .dependencies import ExternalProgram
-from .dependencies import InternalDependency, Dependency, DependencyException
+from .dependencies import InternalDependency, Dependency, NotFoundDependency, DependencyException
from .interpreterbase import InterpreterBase
from .interpreterbase import check_stringlist, noPosargs, noKwargs, stringArgs, permittedKwargs, permittedMethodKwargs
from .interpreterbase import InterpreterException, InvalidArguments, InvalidCode, SubdirDoneRequest
@@ -2501,7 +2501,7 @@ to directly access options of other subprojects.''')
if name == '':
if required:
raise InvalidArguments('Dependency is both required and not-found')
- return DependencyHolder(Dependency('not-found', {}))
+ return DependencyHolder(NotFoundDependency(self.environment))
if '<' in name or '>' in name or '=' in name:
raise InvalidArguments('Characters <, > and = are forbidden in dependency names. To specify'
@@ -2525,7 +2525,7 @@ to directly access options of other subprojects.''')
# We need to actually search for this dep
exception = None
- dep = None
+ dep = NotFoundDependency(self.environment)
# Search for it outside the project
if self.coredata.wrap_mode != WrapMode.forcefallback or 'fallback' not in kwargs:
@@ -2537,7 +2537,7 @@ to directly access options of other subprojects.''')
exception = DependencyException("fallback for %s not found" % name)
# Search inside the projects list
- if not dep or not dep.found():
+ if not dep.found():
if 'fallback' in kwargs:
fallback_dep = self.dependency_fallback(name, kwargs)
if fallback_dep:
@@ -2545,7 +2545,7 @@ to directly access options of other subprojects.''')
# cannot cache them. They must always be evaluated else
# we won't actually read all the build files.
return fallback_dep
- if not dep:
+ if required:
assert(exception is not None)
raise exception