From 17374cf2b462cabf5dd56942ebd4ac84d51c76c9 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Tue, 18 Feb 2020 14:46:51 +0000 Subject: [PATCH] target: Update Target.modules from Target.install_modules() Make sure the target.modules list stays up to date when a new module is installed, since behaviors like devlib_cpu_frequency event injection rely on content of target.modules. --- devlib/target.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/devlib/target.py b/devlib/target.py index a75b4d0..8a92d33 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -906,16 +906,19 @@ class Target(object): self.logger.warning(msg) def _install_module(self, mod, **params): - if mod.name not in self._installed_modules: - self.logger.debug('Installing module {}'.format(mod.name)) + name = mod.name + if name not in self._installed_modules: + self.logger.debug('Installing module {}'.format(name)) try: mod.install(self, **params) except Exception as e: - self.logger.error('Module "{}" failed to install on target'.format(mod.name)) + self.logger.error('Module "{}" failed to install on target'.format(name)) raise - self._installed_modules[mod.name] = mod + self._installed_modules[name] = mod + if name not in self.modules: + self.modules.append(name) else: - self.logger.debug('Module {} is already installed.'.format(mod.name)) + self.logger.debug('Module {} is already installed.'.format(name)) def _resolve_paths(self): raise NotImplementedError()