simplify the yowasp hook, add dg

This commit is contained in:
Peder Bergebakken Sundt 2020-08-06 20:53:02 +02:00
parent cd7f2e511d
commit 7dc7f2765f
1 changed files with 15 additions and 11 deletions

View File

@ -1,17 +1,21 @@
__version__ = '0.1.0' __version__ = '0.1.0'
def load_env(): # YOWASP:
def populate_environ():
import os, shutil import os, shutil
for env_name, program in [
("YOSYS", "yowasp-yosys"),
("NEXTPNR_ICE40", "yowasp-nextpnr-ice40"),
("NEXTPNR_ECP5", "yowasp-nextpnr-ecp5"),
]:
if shutil.which(program):
os.environ[env_name] = program
if shutil.which("yowasp-yosys"): populate_environ()
os.environ["NEXTPNR_ICE40"] = "yowasp-nextpnr-ice40" del populate_environ
if shutil.which("yowasp-nextpnr-ice40"): # dogelang: Slow. Stupid. Absolutely adorable.
os.environ["NEXTPNR_ICE40"] = "yowasp-nextpnr-ice40" import dg # install import hook
if shutil.which("yowasp-nextpnr-ecp5"):
os.environ["NEXTPNR_ECP5"] = "yowasp-nextpnr-ecp5"
load_env()
del load_env