mirror of
https://github.com/litex-hub/litex-boards.git
synced 2025-01-03 03:43:36 -05:00
litex_boards: Remove short imports since not really longer useful and mess up Python imports.
We could maybe find a better implementation to avoid messing up imports but not sure it's really useful. This also enforces consistency in platforms/targets.
This commit is contained in:
parent
28da4f83eb
commit
683226df34
1 changed files with 0 additions and 83 deletions
|
@ -1,83 +0,0 @@
|
|||
import os
|
||||
import sys
|
||||
import glob
|
||||
import importlib
|
||||
|
||||
# Boards Vendors.
|
||||
|
||||
vendors = [
|
||||
"adi",
|
||||
"alinx",
|
||||
"aliexpress",
|
||||
"antmicro",
|
||||
"arduino",
|
||||
"berkeleylab",
|
||||
"colorlight",
|
||||
"decklink",
|
||||
"digilent",
|
||||
"efinix",
|
||||
"enclustra",
|
||||
"gsd",
|
||||
"fairwaves",
|
||||
"hackaday",
|
||||
"kosagi",
|
||||
"krtkl",
|
||||
"lattice",
|
||||
"lambdaconcept",
|
||||
"linsn",
|
||||
"muselab",
|
||||
"myminieye",
|
||||
"numato",
|
||||
"qmtech",
|
||||
"qwertyembedded",
|
||||
"radiona",
|
||||
"rhsresearchllc",
|
||||
"rz",
|
||||
"saanlima",
|
||||
"scarabhardware",
|
||||
"siglent",
|
||||
"sipeed",
|
||||
"seeedstudio",
|
||||
"sqrl",
|
||||
"terasic",
|
||||
"trenz",
|
||||
"tul",
|
||||
"xilinx",
|
||||
]
|
||||
|
||||
# Get all platforms/targets.
|
||||
litex_boards_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
platforms = glob.glob(f"{litex_boards_dir}/platforms/*.py")
|
||||
targets = glob.glob(f"{litex_boards_dir}/targets/*.py")
|
||||
|
||||
# For each platform:
|
||||
for platform in platforms:
|
||||
platform = os.path.basename(platform)
|
||||
platform = platform.replace(".py", "")
|
||||
# Verify if a Vendor prefix is present in platform name, if so create the short import to
|
||||
# allow the platform to be imported with the full name or short name ex:
|
||||
# from litex_boards.platforms import digilent_arty or
|
||||
# from litex_boards.platforms import arty
|
||||
if platform.split("_")[0] in vendors:
|
||||
short_platform = platform[len(platform.split("_")[0])+1:]
|
||||
p = importlib.import_module(f"litex_boards.platforms.{platform}")
|
||||
vars()[short_platform] = p
|
||||
sys.modules[f"litex_boards.platforms.{short_platform}"] = p
|
||||
|
||||
# For each target:
|
||||
for target in targets:
|
||||
target = os.path.basename(target)
|
||||
target = target.replace(".py", "")
|
||||
# Verify if a Vendor prefix is present in target name, if so create the short import to
|
||||
# allow the target to be imported with the full name or short name ex:
|
||||
# from litex_boards.targets import digilent_arty or
|
||||
# from litex_boards.targets import arty
|
||||
if target.split("_")[0] in vendors:
|
||||
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
|
Loading…
Reference in a new issue