f4pga: F4PGA_INSTALL_DIR is optional
Signed-off-by: Unai Martinez-Corral <umartinezcorral@antmicro.com>
This commit is contained in:
parent
5a576e64bc
commit
f8e0f65b48
|
@ -25,7 +25,16 @@ FPGA_FAM = environ.get('FPGA_FAM', 'xc7')
|
|||
if FPGA_FAM not in ['xc7', 'eos-s3', 'qlf_k4n8']:
|
||||
raise(Exception(f"Unsupported FPGA_FAM <{FPGA_FAM}>!"))
|
||||
|
||||
F4PGA_INSTALL_DIR = environ.get('F4PGA_INSTALL_DIR')
|
||||
if F4PGA_INSTALL_DIR is None:
|
||||
raise(Exception("Required environment variable F4PGA_INSTALL_DIR is undefined!"))
|
||||
F4PGA_INSTALL_DIR_PATH = Path(F4PGA_INSTALL_DIR)
|
||||
F4PGA_DEBUG = environ.get('F4PGA_DEBUG')
|
||||
|
||||
install_dir = environ.get('F4PGA_INSTALL_DIR')
|
||||
if install_dir is None:
|
||||
default_install_dir = Path('/usr/local')
|
||||
if F4PGA_DEBUG is not None:
|
||||
print("Environment variable F4PGA_INSTALL_DIR is undefined!")
|
||||
print(f"Using default {default_install_dir}")
|
||||
F4PGA_INSTALL_DIR = default_install_dir
|
||||
else:
|
||||
F4PGA_INSTALL_DIR = Path(install_dir)
|
||||
|
||||
F4PGA_SHARE_DIR = Path(environ.get('F4PGA_SHARE_DIR', F4PGA_INSTALL_DIR / FPGA_FAM / 'share/f4pga'))
|
||||
|
|
|
@ -25,14 +25,11 @@ from shutil import move as sh_mv
|
|||
from subprocess import run
|
||||
from re import match as re_match, finditer as re_finditer
|
||||
|
||||
from f4pga.context import FPGA_FAM
|
||||
from f4pga.context import FPGA_FAM, F4PGA_SHARE_DIR
|
||||
|
||||
|
||||
install_dir = environ.get("F4PGA_INSTALL_DIR", "/usr/local")
|
||||
bin_dir_path = str(Path(sys_argv[0]).resolve().parent.parent)
|
||||
share_dir_path = \
|
||||
environ.get('F4PGA_SHARE_DIR',
|
||||
str(Path(f'{install_dir}/{FPGA_FAM}/share/f4pga').resolve()))
|
||||
share_dir_path = str(F4PGA_SHARE_DIR)
|
||||
|
||||
|
||||
class F4PGAException(Exception):
|
||||
|
|
|
@ -25,7 +25,7 @@ from pathlib import Path
|
|||
from shutil import which
|
||||
from subprocess import check_call
|
||||
|
||||
from f4pga.context import FPGA_FAM, F4PGA_INSTALL_DIR_PATH
|
||||
from f4pga.context import FPGA_FAM, F4PGA_SHARE_DIR
|
||||
|
||||
python3 = which('python3')
|
||||
|
||||
|
@ -35,7 +35,7 @@ isQuickLogic = FPGA_FAM != 'xc7'
|
|||
SH_SUBDIR = 'quicklogic' if isQuickLogic else FPGA_FAM
|
||||
|
||||
f4pga_environ = environ.copy()
|
||||
f4pga_environ['F4PGA_SHARE_DIR'] = f4pga_environ.get('F4PGA_SHARE_DIR', str(F4PGA_INSTALL_DIR_PATH / FPGA_FAM / 'share/f4pga'))
|
||||
f4pga_environ['F4PGA_SHARE_DIR'] = f4pga_environ.get('F4PGA_SHARE_DIR', F4PGA_SHARE_DIR)
|
||||
|
||||
|
||||
# Helper functions
|
||||
|
|
Loading…
Reference in New Issue