1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-24 21:47:50 +00:00

target: Remove failed modules from target.modules

When a module is not supported by the target, remove it from the
"modules" list attribute, so code can check if a module was successfully
loaded by just looking at that list after Target.setup() is done.
This commit is contained in:
Douglas RAILLARD 2018-10-31 16:33:34 +00:00 committed by Marc Bonnici
parent 4a4739cefb
commit da3afeba2e

@ -24,6 +24,7 @@ import tarfile
import tempfile
import threading
import xml.dom.minidom
import copy
from collections import namedtuple, defaultdict
from devlib.host import LocalConnection, PACKAGE_BIN_DIRECTORY
@ -741,18 +742,19 @@ class Target(object):
return extracted
def _update_modules(self, stage):
for mod in self.modules:
if isinstance(mod, dict):
mod, params = list(mod.items())[0]
for mod_name in copy.copy(self.modules):
if isinstance(mod_name, dict):
mod_name, params = list(mod_name.items())[0]
else:
params = {}
mod = get_module(mod)
mod = get_module(mod_name)
if not mod.stage == stage:
continue
if mod.probe(self):
self._install_module(mod, **params)
else:
msg = 'Module {} is not supported by the target'.format(mod.name)
self.modules.remove(mod_name)
if self.load_default_modules:
self.logger.debug(msg)
else: