Use yowasp-icepack

This commit is contained in:
Peder Bergebakken Sundt 2020-08-20 16:18:29 +02:00
parent 99504c4026
commit 18bf707fdc
1 changed files with 18 additions and 8 deletions

View File

@ -3,22 +3,32 @@ __version__ = '0.1.0'
# YOWASP:
def populate_environ():
def populate_environ_with_yowasp():
import os, shutil
for nmigen_envvar, expected_path, alternative_path in [
("SBY", "sby", "yowasp-sby"),
("YOSYS", "yosys", "yowasp-yosys"), # nmigen-yosys is handled by nmigen
("NEXTPNR_ICE40", "nextpnr-ice40", "yowasp-nextpnr-ice40"),
("NEXTPNR_ECP5", "nextpnr-ecp5", "yowasp-nextpnr-ecp5"),
("NEXTPNR_ICE40", "nextpnr-ice40", "yowasp-nextpnr-ice40"),
("NEXTPNR_ICE40", "nextpnr-ice40", "yowasp-nextpnr-ice40"),
("ICEBRAM", "icebram", "yowasp-icebram"),
("ICEMULTI", "icemulti", "yowasp-icemulti"),
("ICEPACK", "icepack", "yowasp-icepack"),
("ICEPLL", "icepll", "yowasp-icepll"),
("ICEUNPACK", "iceunpack", "yowasp-iceunpack"),
]:
if nmigen_envvar in os.environ: continue
if shutil.which(expected_path): continue
if not shutil.which(alternative_path): continue
os.environ[nmigen_envvar] = alternative_path
populate_environ()
del populate_environ
populate_environ_with_yowasp()
del populate_environ_with_yowasp
# dogelang: Slow. Stupid. Absolutely adorable.
import dg # setup the dg import hook
del dg