mirror of https://github.com/VLSIDA/OpenRAM.git
Add checks for valid OPENRAM_HOME and OPENRAM_TECH directories and subdirs
This commit is contained in:
parent
cffcd46f6d
commit
b16dd80088
|
|
@ -9,6 +9,12 @@ import sys
|
||||||
# 2 = verbose
|
# 2 = verbose
|
||||||
# n = custom setting
|
# n = custom setting
|
||||||
|
|
||||||
|
def check(check,str):
|
||||||
|
(frame, filename, line_number, function_name, lines,
|
||||||
|
index) = inspect.getouterframes(inspect.currentframe())[1]
|
||||||
|
if not check:
|
||||||
|
print "ERROR: file ", os.path.basename(filename), ": line ", line_number, ": ", str
|
||||||
|
sys.exit(-1)
|
||||||
|
|
||||||
def error(str,return_value=None):
|
def error(str,return_value=None):
|
||||||
(frame, filename, line_number, function_name, lines,
|
(frame, filename, line_number, function_name, lines,
|
||||||
|
|
|
||||||
|
|
@ -164,10 +164,17 @@ def setup_paths():
|
||||||
try:
|
try:
|
||||||
OPENRAM_HOME = os.path.abspath(os.environ.get("OPENRAM_HOME"))
|
OPENRAM_HOME = os.path.abspath(os.environ.get("OPENRAM_HOME"))
|
||||||
except:
|
except:
|
||||||
debug.error("OPENRAM_HOME is not properly defined.",1)
|
debug.error("$OPENRAM_HOME is not properly defined.",1)
|
||||||
sys.path.append("{0}".format(OPENRAM_HOME))
|
debug.check(os.path.isdir(OPENRAM_HOME),"$OPENRAM_HOME does not exist: {0}".format(OPENRAM_HOME))
|
||||||
|
|
||||||
|
debug.check(os.path.isdir(OPENRAM_HOME+"/gdsMill"),
|
||||||
|
"$OPENRAM_HOME/gdsMill does not exist: {0}".format(OPENRAM_HOME+"/gdsMill"))
|
||||||
sys.path.append("{0}/gdsMill".format(OPENRAM_HOME))
|
sys.path.append("{0}/gdsMill".format(OPENRAM_HOME))
|
||||||
|
debug.check(os.path.isdir(OPENRAM_HOME+"/tests"),
|
||||||
|
"$OPENRAM_HOME/tests does not exist: {0}".format(OPENRAM_HOME+"/tests"))
|
||||||
sys.path.append("{0}/tests".format(OPENRAM_HOME))
|
sys.path.append("{0}/tests".format(OPENRAM_HOME))
|
||||||
|
debug.check(os.path.isdir(OPENRAM_HOME+"/characterizer"),
|
||||||
|
"$OPENRAM_HOME/characterizer does not exist: {0}".format(OPENRAM_HOME+"/characterizer"))
|
||||||
sys.path.append("{0}/characterizer".format(OPENRAM_HOME))
|
sys.path.append("{0}/characterizer".format(OPENRAM_HOME))
|
||||||
|
|
||||||
if not OPTS.openram_temp.endswith('/'):
|
if not OPTS.openram_temp.endswith('/'):
|
||||||
|
|
@ -258,7 +265,8 @@ def import_tech():
|
||||||
try:
|
try:
|
||||||
OPENRAM_TECH = os.path.abspath(os.environ.get("OPENRAM_TECH"))
|
OPENRAM_TECH = os.path.abspath(os.environ.get("OPENRAM_TECH"))
|
||||||
except:
|
except:
|
||||||
debug.error("OPENRAM_TECH is not properly defined.",1)
|
debug.error("$OPENRAM_TECH is not properly defined.",1)
|
||||||
|
debug.check(os.path.isdir(OPENRAM_TECH),"$OPENRAM_TECH does not exist: {0}".format(OPENRAM_TECH))
|
||||||
|
|
||||||
OPTS.openram_tech = OPENRAM_TECH + "/" + OPTS.tech_name
|
OPTS.openram_tech = OPENRAM_TECH + "/" + OPTS.tech_name
|
||||||
if not OPTS.openram_tech.endswith('/'):
|
if not OPTS.openram_tech.endswith('/'):
|
||||||
|
|
@ -270,6 +278,7 @@ def import_tech():
|
||||||
# we assume that the setup scripts (and tech dirs) are located at the
|
# we assume that the setup scripts (and tech dirs) are located at the
|
||||||
# same level as the compielr itself, probably not a good idea though.
|
# same level as the compielr itself, probably not a good idea though.
|
||||||
path = "{0}/setup_scripts".format(os.environ.get("OPENRAM_TECH"))
|
path = "{0}/setup_scripts".format(os.environ.get("OPENRAM_TECH"))
|
||||||
|
debug.check(os.path.isdir(path),"OPENRAM_TECH does not exist: {0}".format(path))
|
||||||
sys.path.append(os.path.abspath(path))
|
sys.path.append(os.path.abspath(path))
|
||||||
__import__(filename)
|
__import__(filename)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue