f4pga/wrappers/sh: do not require F4PGA_ENV_* envvars as long as F4PGA_INSTALL_DIR is defined

Create them and pass a custom env to run_sh

Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
Unai Martinez-Corral 2022-05-26 11:51:51 +02:00
parent 3b7ba9b15a
commit b51e8e3a0c
1 changed files with 12 additions and 3 deletions

View File

@ -24,15 +24,24 @@ from pathlib import Path
from subprocess import check_call from subprocess import check_call
f4pga_environ = environ.copy()
ROOT = Path(__file__).resolve().parent ROOT = Path(__file__).resolve().parent
F4PGA_FAM = environ.get('F4PGA_FAM', 'xc7') F4PGA_FAM = f4pga_environ.get('F4PGA_FAM', 'xc7')
SH_SUBDIR = 'quicklogic' if F4PGA_FAM == 'eos-s3' else F4PGA_FAM isQuickLogic = F4PGA_FAM == 'eos-s3'
SH_SUBDIR = 'quicklogic' if isQuickLogic else F4PGA_FAM
F4PGA_INSTALL_DIR = Path(f4pga_environ.get('F4PGA_INSTALL_DIR'))
f4pga_environ['F4PGA_ENV_BIN'] = f4pga_environ.get('F4PGA_ENV_BIN', str(F4PGA_INSTALL_DIR / F4PGA_FAM / 'conda/bin'))
f4pga_environ['F4PGA_ENV_SHARE'] = f4pga_environ.get('F4PGA_ENV_SHARE', str(F4PGA_INSTALL_DIR / F4PGA_FAM / (
'share' if isQuickLogic else 'install/share/symbiflow'
)))
def run_sh(script): def run_sh(script):
stdout.flush() stdout.flush()
stderr.flush() stderr.flush()
check_call([str(script)]+sys_argv[1:]) check_call([str(script)]+sys_argv[1:], env=f4pga_environ)
def generate_constraints(): def generate_constraints():