Make the yowasp hook smarter
This commit is contained in:
parent
7f6b133241
commit
e3da4a696a
|
@ -6,16 +6,18 @@ __version__ = '0.1.0'
|
||||||
def populate_environ():
|
def populate_environ():
|
||||||
import os, shutil
|
import os, shutil
|
||||||
|
|
||||||
for env_name, program in [
|
for nmigen_envvar, expected_path, alternative_path in [
|
||||||
("YOSYS", "yowasp-yosys"),
|
("YOSYS", "yosys", "yowasp-yosys"), # nmigen-yosys is handled by nmigen
|
||||||
("NEXTPNR_ICE40", "yowasp-nextpnr-ice40"),
|
("NEXTPNR_ICE40", "nextpnr-ice40", "yowasp-nextpnr-ice40"),
|
||||||
("NEXTPNR_ECP5", "yowasp-nextpnr-ecp5"),
|
("NEXTPNR_ECP5", "nextpnr-ecp5", "yowasp-nextpnr-ecp5"),
|
||||||
]:
|
]:
|
||||||
if shutil.which(program):
|
if nmigen_envvar in os.environ: continue
|
||||||
os.environ[env_name] = program
|
if shutil.which(expected_path): continue
|
||||||
|
if not shutil.which(alternative_path): continue
|
||||||
|
os.environ[nmigen_envvar] = alternative_path
|
||||||
|
|
||||||
populate_environ()
|
populate_environ()
|
||||||
del populate_environ
|
del populate_environ
|
||||||
|
|
||||||
# dogelang: Slow. Stupid. Absolutely adorable.
|
# dogelang: Slow. Stupid. Absolutely adorable.
|
||||||
import dg # install import hook
|
import dg # setup the dg import hook
|
||||||
|
|
Loading…
Reference in New Issue