diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-03-02 09:37:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 09:37:57 -0800 |
commit | 6e865fc08d0d13b3846d00e80c9f3ea090645fb8 (patch) | |
tree | ac190b1f4ae81e37da23c7e4e4a45b6827a2c684 /mesonbuild/interpreter.py | |
parent | b190a20ad564a27fbda57c2dab87f35f07589d6a (diff) | |
parent | d67888bf9b398b9ff9709d396569260f98971e8a (diff) | |
download | meson-6e865fc08d0d13b3846d00e80c9f3ea090645fb8.zip meson-6e865fc08d0d13b3846d00e80c9f3ea090645fb8.tar.gz meson-6e865fc08d0d13b3846d00e80c9f3ea090645fb8.tar.bz2 |
Merge pull request #6316 from mensinda/typesAst
types: Annotations for ast, mparser.py, interpreterbase.py
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 28 |
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 != '' |