Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def init(self):
lbuild.utils.with_forward_exception(self,
lambda: self._functions['init'](lf.RepositoryInitFacade(self)))
return Repository(self)
def init(self):
# Execute init() function from module to get module name
lbuild.utils.with_forward_exception(
self,
lambda: self.functions['init'](lf.ModuleInitFacade(self)))
if self.name is None:
raise le.LbuildModuleNoNameException(self)
if self.parent is None and ":" not in self.name:
self.parent = self.context_parent
parent_parent, parent_name = self._clean(self.parent)
name_parent, self.name = self._clean(self.name)
self.parent = ":".join(p.strip(":") for p in (self.repository.name,
parent_parent, parent_name, name_parent) if p)
self.order = int(self.order)
def validate(self, env):
validate = self._functions.get("validate", self._functions.get("pre_build", None))
if validate is not None:
LOGGER.info("Validate {}".format(self.fullname))
lbuild.utils.with_forward_exception(self, lambda: validate(env.facade))
def build(self, env):
build = self._functions.get("build", None)
if build is not None:
LOGGER.info("Build %s", self.fullname)
lbuild.utils.with_forward_exception(self, lambda: build(env.facade))
def prepare(self):
self.available = lbuild.utils.with_forward_exception(
self,
lambda: self.functions["prepare"](lf.ModulePrepareFacade(self),
self.repository.option_value_resolver))
all_modules = [self]
if self.available is None:
raise le.LbuildModuleNoReturnAvailableException(self)
for submodule in self._submodules:
if isinstance(submodule, str):
modules = load_module_from_file(repository=self.repository,
filename=os.path.join(self.filepath, submodule),
parent=self.fullname)
else:
modules = load_module_from_object(repository=self.repository,
module_obj=submodule,
def prepare(self):
lbuild.utils.with_forward_exception(
self,
lambda: self._functions["prepare"](lf.RepositoryPrepareFacade(self),
self.option_value_resolver))
modules = []
# Parse the module files inside this repository
for modulefile in self._module_files:
module = lbuild.module.load_module_from_file(repository=self,
filename=modulefile)
modules.extend(module)
# Parse the module objects inside the repo file
for submodule in self._submodules:
module = lbuild.module.load_module_from_object(repository=self,
module_obj=submodule,
filename=self._filename)
modules.extend(module)
def post_build(self, env):
post_build = self._functions.get("post_build", None)
if post_build is not None:
LOGGER.info("Post-Build {}".format(self.fullname))
if len(inspect.signature(post_build).parameters.keys()) == 1:
func = lambda: post_build(env.facade)
else:
func = lambda: post_build(env.facade, env.facade_buildlog)
lbuild.utils.with_forward_exception(self, func)