aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-12-06 23:38:30 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-12-07 00:08:16 +0530
commit7b8f41ce31c76bb4b6e86b2583c464a438ac4641 (patch)
tree174fe21f7c5e53081d612013a20bf425b1b25ef9 /mesonbuild/interpreter.py
parent541dd92ef7a10b0f657f3c8532ffb71a8d921f54 (diff)
downloadmeson-7b8f41ce31c76bb4b6e86b2583c464a438ac4641.zip
meson-7b8f41ce31c76bb4b6e86b2583c464a438ac4641.tar.gz
meson-7b8f41ce31c76bb4b6e86b2583c464a438ac4641.tar.bz2
Compiler checks can only accept external dependencies
This is already how it should've been, but: a) The test for this was wrong since Dependency is a base class for all dependencies and isinstance on an InternalDependency will also be true b) Internal dependencies can't ever be used here anyway because compiler checks are always run at configure time and internal dependencies are only built after that.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e54d906..6b62d75 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -22,6 +22,7 @@ from . import optinterpreter
from . import compilers
from .wrap import wrap
from . import mesonlib
+from .dependencies import InternalDependency, Dependency
from mesonbuild.interpreterbase import InterpreterBase
from mesonbuild.interpreterbase import check_stringlist, noPosargs, noKwargs, stringArgs
from mesonbuild.interpreterbase import InterpreterException, InvalidArguments, InvalidCode
@@ -649,10 +650,8 @@ class CompilerHolder(InterpreterObject):
args += mesonlib.stringlistify(kwargs.get('args', []))
return args
- def determine_dependencies(self, kwargs, allowed_dep_types=None):
+ def determine_dependencies(self, kwargs):
deps = kwargs.get('dependencies', None)
- if allowed_dep_types is None:
- allowed_dep_types = (dependencies.Dependency, dependencies.ExternalLibrary)
if deps is not None:
if not isinstance(deps, list):
deps = [deps]
@@ -662,8 +661,8 @@ class CompilerHolder(InterpreterObject):
d = d.held_object
except Exception:
pass
- if not isinstance(d, allowed_dep_types):
- raise InterpreterException('Dependencies must be external deps')
+ if isinstance(d, InternalDependency) or not isinstance(d, Dependency):
+ raise InterpreterException('Dependencies must be external dependencies')
final_deps.append(d)
deps = final_deps
return deps
@@ -722,7 +721,7 @@ class CompilerHolder(InterpreterObject):
if not isinstance(prefix, str):
raise InterpreterException('Prefix argument of has_member must be a string.')
extra_args = self.determine_args(kwargs)
- deps = self.determine_dependencies(kwargs, allowed_dep_types=(dependencies.Dependency,))
+ deps = self.determine_dependencies(kwargs)
had = self.compiler.has_members(typename, [membername], prefix,
self.environment, extra_args, deps)
if had:
@@ -741,7 +740,7 @@ class CompilerHolder(InterpreterObject):
if not isinstance(prefix, str):
raise InterpreterException('Prefix argument of has_members must be a string.')
extra_args = self.determine_args(kwargs)
- deps = self.determine_dependencies(kwargs, allowed_dep_types=(dependencies.Dependency,))
+ deps = self.determine_dependencies(kwargs)
had = self.compiler.has_members(typename, membernames, prefix,
self.environment, extra_args, deps)
if had:
@@ -798,7 +797,7 @@ class CompilerHolder(InterpreterObject):
if not isinstance(prefix, str):
raise InterpreterException('Prefix argument of sizeof must be a string.')
extra_args = self.determine_args(kwargs)
- deps = self.determine_dependencies(kwargs, allowed_dep_types=(dependencies.Dependency,))
+ deps = self.determine_dependencies(kwargs)
esize = self.compiler.sizeof(element, prefix, self.environment, extra_args, deps)
mlog.log('Checking for size of "%s": %d' % (element, esize))
return esize
@@ -816,7 +815,7 @@ class CompilerHolder(InterpreterObject):
if not isinstance(testname, str):
raise InterpreterException('Testname argument must be a string.')
extra_args = self.determine_args(kwargs)
- deps = self.determine_dependencies(kwargs, allowed_dep_types=(dependencies.Dependency,))
+ deps = self.determine_dependencies(kwargs)
result = self.compiler.compiles(code, self.environment, extra_args, deps)
if len(testname) > 0:
if result:
@@ -858,7 +857,7 @@ class CompilerHolder(InterpreterObject):
if not isinstance(prefix, str):
raise InterpreterException('Prefix argument of has_header must be a string.')
extra_args = self.determine_args(kwargs)
- deps = self.determine_dependencies(kwargs, allowed_dep_types=(dependencies.Dependency,))
+ deps = self.determine_dependencies(kwargs)
haz = self.compiler.has_header(hname, prefix, self.environment, extra_args, deps)
if haz:
h = mlog.green('YES')
@@ -877,7 +876,7 @@ class CompilerHolder(InterpreterObject):
if not isinstance(prefix, str):
raise InterpreterException('Prefix argument of has_header_symbol must be a string.')
extra_args = self.determine_args(kwargs)
- deps = self.determine_dependencies(kwargs, allowed_dep_types=(dependencies.Dependency,))
+ deps = self.determine_dependencies(kwargs)
haz = self.compiler.has_header_symbol(hname, symbol, prefix, self.environment, extra_args, deps)
if haz:
h = mlog.green('YES')