From 2e204285de9bfd15589f44d974d118db2ad704fb Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 10 Apr 2021 11:41:13 +0200 Subject: [PATCH] boards/compat: Skip targets with unsatisfied dependencies. Fixes #194 --- litex_boards/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/litex_boards/__init__.py b/litex_boards/__init__.py index 26debb4..aa15b15 100644 --- a/litex_boards/__init__.py +++ b/litex_boards/__init__.py @@ -58,7 +58,11 @@ for target in targets: # from litex_boards.targets import digilent_arty or # from litex_boards.targets import arty if target.split("_")[0] in vendors: - short_target = target[len(target.split("_")[0])+1:] - t = importlib.import_module(f"litex_boards.targets.{target}") - vars()[short_target] = t - sys.modules[f"litex_boards.targets.{short_target}"] = t + try: + short_target = target[len(target.split("_")[0])+1:] + t = importlib.import_module(f"litex_boards.targets.{target}") + vars()[short_target] = t + sys.modules[f"litex_boards.targets.{short_target}"] = t + except ModuleNotFoundError: + # Not all dependencies for this target is satisfied. Skip. + pass