From b51e8e3a0c6597d56dcc99b19b69d00546719e8b Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Thu, 26 May 2022 11:51:51 +0200 Subject: [PATCH] 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 --- f4pga/wrappers/sh/__init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/f4pga/wrappers/sh/__init__.py b/f4pga/wrappers/sh/__init__.py index ada659f..ab8a99a 100644 --- a/f4pga/wrappers/sh/__init__.py +++ b/f4pga/wrappers/sh/__init__.py @@ -24,15 +24,24 @@ from pathlib import Path from subprocess import check_call +f4pga_environ = environ.copy() + ROOT = Path(__file__).resolve().parent -F4PGA_FAM = environ.get('F4PGA_FAM', 'xc7') -SH_SUBDIR = 'quicklogic' if F4PGA_FAM == 'eos-s3' else F4PGA_FAM +F4PGA_FAM = f4pga_environ.get('F4PGA_FAM', 'xc7') +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): stdout.flush() stderr.flush() - check_call([str(script)]+sys_argv[1:]) + check_call([str(script)]+sys_argv[1:], env=f4pga_environ) def generate_constraints():