sys.path can contain duplicate entries for each layer, which means that
the search in add_controller_list() will find the same name twice and
abort.
As duplicate directories should be harmless, remove any duplicates before
iterating through the entries.
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
else:
raise RuntimeError("Duplicate controller module found for %s. Layers should create unique controller module names" % module)
- for p in sys.path:
+ # sys.path can contain duplicate paths, but because of the login in
+ # add_controller_list this doesn't work and causes testimage to abort.
+ # Remove duplicates using an intermediate dictionary to ensure this
+ # doesn't happen.
+ for p in list(dict.fromkeys(sys.path)):
controllerpath = os.path.join(p, 'oeqa', 'controllers')
if os.path.exists(controllerpath):
add_controller_list(controllerpath)