diff options
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/methods.py b/methods.py index 9e881773c9..6f8b11819b 100644 --- a/methods.py +++ b/methods.py @@ -73,21 +73,13 @@ def print_error(*values: object) -> None: def add_source_files_orig(self, sources, files, allow_gen=False): # Convert string to list of absolute paths (including expanding wildcard) - if isinstance(files, (str, bytes)): - # Keep SCons project-absolute path as they are (no wildcard support) - if files.startswith("#"): - if "*" in files: - print_error("Wildcards can't be expanded in SCons project-absolute path: '{}'".format(files)) - return - files = [files] - else: - # Exclude .gen.cpp files from globbing, to avoid including obsolete ones. - # They should instead be added manually. - skip_gen_cpp = "*" in files - dir_path = self.Dir(".").abspath - files = sorted(glob.glob(dir_path + "/" + files)) - if skip_gen_cpp and not allow_gen: - files = [f for f in files if not f.endswith(".gen.cpp")] + if isinstance(files, str): + # Exclude .gen.cpp files from globbing, to avoid including obsolete ones. + # They should instead be added manually. + skip_gen_cpp = "*" in files + files = self.Glob(files) + if skip_gen_cpp and not allow_gen: + files = [f for f in files if not str(f).endswith(".gen.cpp")] # Add each path as compiled Object following environment (self) configuration for path in files: @@ -404,10 +396,6 @@ def convert_custom_modules_path(path): return path -def disable_module(self): - self.disabled_modules.append(self.current_module) - - def module_add_dependencies(self, module, dependencies, optional=False): """ Adds dependencies for a given module. @@ -428,19 +416,21 @@ def module_check_dependencies(self, module): Meant to be used in module `can_build` methods. Returns a boolean (True if dependencies are satisfied). """ - missing_deps = [] + missing_deps = set() required_deps = self.module_dependencies[module][0] if module in self.module_dependencies else [] for dep in required_deps: opt = "module_{}_enabled".format(dep) - if opt not in self or not self[opt]: - missing_deps.append(dep) - - if missing_deps != []: - print_warning( - "Disabling '{}' module as the following dependencies are not satisfied: {}".format( - module, ", ".join(missing_deps) + if opt not in self or not self[opt] or not module_check_dependencies(self, dep): + missing_deps.add(dep) + + if missing_deps: + if module not in self.disabled_modules: + print_warning( + "Disabling '{}' module as the following dependencies are not satisfied: {}".format( + module, ", ".join(missing_deps) + ) ) - ) + self.disabled_modules.add(module) return False else: return True |