Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def listify(*node):
return lbuild.utils.listify(*node)
def _filter_modules(self, modules=None):
if self.parser._undefined_repo_options():
return []
self.parser.config.modules.extend(listify(modules))
selected_modules = self.parser.find_modules(self.parser.config.modules)
return self.parser.resolve_dependencies(selected_modules)
def _update_dependencies(self):
if self._dependency_handler:
deps = lbuild.utils.listify(self._dependency_handler(self._input))
self.parent.add_dependencies(*deps)
def __init__(self, module_name, outpath, module_path,
filename_in: str, filename_out: str, time=None, metadata=None):
self.module_name = module_name
self.time = time
self.metadata = collections.defaultdict(set)
if metadata:
for key, values in metadata.items():
for value in lbuild.utils.listify(values):
self.metadata[key].add(value)
self.outpath = abspath(outpath)
self.inpath = abspath(module_path)
self.filename_in = abspath(filename_in)
self.filename_out = abspath(filename_out)
file_config = ConfigNode()
else:
file_config = filesystem_config
# 2. config is file: create file config and extend if with filesystem config
elif os.path.exists(config):
file_config = ConfigNode.from_file(config)
if file_config is not None:
file_config.extend_last(filesystem_config)
# 3. config is alias: create virtual config and extend it with alias
else:
file_config = ConfigNode()
file_config.filename = "command-line"
file_config._extends["command-line"].append(config)
self.config = file_config
self.config.add_commandline_options(listify(options))
self.config.add_commandline_collectors(listify(collectors))
self.parser = Parser(self.config)