diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-03-02 21:49:23 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-03-06 13:11:20 +0200 |
commit | fcbab5948c364b2be9ba0d23f0c1ed9523adc9bb (patch) | |
tree | c0964855e0d9c984774d1bafb71c79d4c87c12b9 /mesonbuild/ast/interpreter.py | |
parent | 85796229c29898588cc1e0a80e31485e358289d5 (diff) | |
download | meson-fcbab5948c364b2be9ba0d23f0c1ed9523adc9bb.zip meson-fcbab5948c364b2be9ba0d23f0c1ed9523adc9bb.tar.gz meson-fcbab5948c364b2be9ba0d23f0c1ed9523adc9bb.tar.bz2 |
Refactor subdir visitation to track files instead of dirs.
Diffstat (limited to 'mesonbuild/ast/interpreter.py')
-rw-r--r-- | mesonbuild/ast/interpreter.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py index 73db15c..98d141d 100644 --- a/mesonbuild/ast/interpreter.py +++ b/mesonbuild/ast/interpreter.py @@ -70,10 +70,10 @@ class AstInterpreter(interpreterbase.InterpreterBase): def __init__(self, source_root: str, subdir: str, subproject: str, visitors: T.Optional[T.List[AstVisitor]] = None): super().__init__(source_root, subdir, subproject) self.visitors = visitors if visitors is not None else [] - self.visited_subdirs = {} # type: T.Dict[str, bool] - self.assignments = {} # type: T.Dict[str, BaseNode] - self.assign_vals = {} # type: T.Dict[str, T.Any] - self.reverse_assignment = {} # type: T.Dict[str, BaseNode] + self.processed_buildfiles = set() # type: T.Set[str] + self.assignments = {} # type: T.Dict[str, BaseNode] + self.assign_vals = {} # type: T.Dict[str, T.Any] + self.reverse_assignment = {} # type: T.Dict[str, BaseNode] self.funcs.update({'project': self.func_do_nothing, 'test': self.func_do_nothing, 'benchmark': self.func_do_nothing, @@ -150,10 +150,11 @@ class AstInterpreter(interpreterbase.InterpreterBase): buildfilename = os.path.join(subdir, environment.build_filename) absname = os.path.join(self.source_root, buildfilename) symlinkless_dir = os.path.realpath(absdir) - if symlinkless_dir in self.visited_subdirs: + build_file = os.path.join(symlinkless_dir, 'meson.build') + if build_file in self.processed_buildfiles: sys.stderr.write('Trying to enter {} which has already been visited --> Skipping\n'.format(args[0])) return - self.visited_subdirs[symlinkless_dir] = True + self.processed_buildfiles.add(build_file) if not os.path.isfile(absname): sys.stderr.write(f'Unable to find build file {buildfilename} --> Skipping\n') |