mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-25 05:57:51 +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:
parent
4a4739cefb
commit
da3afeba2e
@ -24,6 +24,7 @@ import tarfile
|
|||||||
import tempfile
|
import tempfile
|
||||||
import threading
|
import threading
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
|
import copy
|
||||||
from collections import namedtuple, defaultdict
|
from collections import namedtuple, defaultdict
|
||||||
|
|
||||||
from devlib.host import LocalConnection, PACKAGE_BIN_DIRECTORY
|
from devlib.host import LocalConnection, PACKAGE_BIN_DIRECTORY
|
||||||
@ -741,18 +742,19 @@ class Target(object):
|
|||||||
return extracted
|
return extracted
|
||||||
|
|
||||||
def _update_modules(self, stage):
|
def _update_modules(self, stage):
|
||||||
for mod in self.modules:
|
for mod_name in copy.copy(self.modules):
|
||||||
if isinstance(mod, dict):
|
if isinstance(mod_name, dict):
|
||||||
mod, params = list(mod.items())[0]
|
mod_name, params = list(mod_name.items())[0]
|
||||||
else:
|
else:
|
||||||
params = {}
|
params = {}
|
||||||
mod = get_module(mod)
|
mod = get_module(mod_name)
|
||||||
if not mod.stage == stage:
|
if not mod.stage == stage:
|
||||||
continue
|
continue
|
||||||
if mod.probe(self):
|
if mod.probe(self):
|
||||||
self._install_module(mod, **params)
|
self._install_module(mod, **params)
|
||||||
else:
|
else:
|
||||||
msg = 'Module {} is not supported by the target'.format(mod.name)
|
msg = 'Module {} is not supported by the target'.format(mod.name)
|
||||||
|
self.modules.remove(mod_name)
|
||||||
if self.load_default_modules:
|
if self.load_default_modules:
|
||||||
self.logger.debug(msg)
|
self.logger.debug(msg)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user