aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 2769c2d..dad2933 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2182,13 +2182,12 @@ class Interpreter(InterpreterBase):
def __init__(self, build, backend=None, subproject='', subdir='', subproject_dir='subprojects',
modules = None, default_project_options=None, mock=False, ast=None):
- super().__init__(build.environment.get_source_dir(), subdir)
+ super().__init__(build.environment.get_source_dir(), subdir, subproject)
self.an_unpicklable_object = mesonlib.an_unpicklable_object
self.build = build
self.environment = build.environment
self.coredata = self.environment.get_coredata()
self.backend = backend
- self.subproject = subproject
self.summary = {}
if modules is None:
self.modules = {}
@@ -4426,15 +4425,15 @@ Try setting b_lundef to false instead.'''.format(self.coredata.base_options['b_s
ef = extract_as_list(kwargs, 'extra_files')
kwargs['extra_files'] = self.source_strings_to_files(ef)
self.check_sources_exist(os.path.join(self.source_root, self.subdir), sources)
- if targetholder is ExecutableHolder:
+ if targetholder == ExecutableHolder:
targetclass = build.Executable
- elif targetholder is SharedLibraryHolder:
+ elif targetholder == SharedLibraryHolder:
targetclass = build.SharedLibrary
- elif targetholder is SharedModuleHolder:
+ elif targetholder == SharedModuleHolder:
targetclass = build.SharedModule
- elif targetholder is StaticLibraryHolder:
+ elif targetholder == StaticLibraryHolder:
targetclass = build.StaticLibrary
- elif targetholder is JarHolder:
+ elif targetholder == JarHolder:
targetclass = build.Jar
else:
mlog.debug('Unknown target type:', str(targetholder))
@@ -4500,7 +4499,7 @@ This will become a hard error in the future.''', location=self.current_node)
raise InterpreterException('Tried to add non-existing source file %s.' % s)
# Only permit object extraction from the same subproject
- def validate_extraction(self, buildtarget):
+ def validate_extraction(self, buildtarget: InterpreterObject) -> None:
if not self.subdir.startswith(self.subproject_dir):
if buildtarget.subdir.startswith(self.subproject_dir):
raise InterpreterException('Tried to extract objects from a subproject target.')
@@ -4510,19 +4509,6 @@ This will become a hard error in the future.''', location=self.current_node)
if self.subdir.split('/')[1] != buildtarget.subdir.split('/')[1]:
raise InterpreterException('Tried to extract objects from a different subproject.')
- def check_contains(self, obj, args):
- if len(args) != 1:
- raise InterpreterException('Contains method takes exactly one argument.')
- item = args[0]
- for element in obj:
- if isinstance(element, list):
- found = self.check_contains(element, args)
- if found:
- return True
- if element == item:
- return True
- return False
-
def is_subproject(self):
return self.subproject != ''