|
@ -36,7 +36,7 @@ def getExistingPath(job, pathnames): |
|
|
return pathname |
|
|
return pathname |
|
|
return None |
|
|
return None |
|
|
|
|
|
|
|
|
def getConfigPath(job, modul, name, subname=""): |
|
|
def select_config_path(job, modul, name, subname=""): |
|
|
""" |
|
|
""" |
|
|
gets the most specified configuration of different sources |
|
|
gets the most specified configuration of different sources |
|
|
Parameter: |
|
|
Parameter: |
|
@ -55,26 +55,10 @@ def getConfigPath(job, modul, name, subname=""): |
|
|
if job is None: |
|
|
if job is None: |
|
|
verify = False # job = basic.program.Job.getInstance() |
|
|
verify = False # job = basic.program.Job.getInstance() |
|
|
else: |
|
|
else: |
|
|
verify = job.getDebugLevel("config_tool")-4 |
|
|
verify = job.getDebugLevel("config_tool") |
|
|
if verify: job.debug(verify, "getConfig " + modul + ", " + name) |
|
|
if verify: job.debug(verify, "getConfig " + modul + ", " + name) |
|
|
if modul == P.KEY_TOOL: |
|
|
if modul == P.KEY_TOOL: |
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
return getToolPath(job, name, subname) |
|
|
P.VAL_CONFIG, name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_HOME], |
|
|
|
|
|
P.VAL_CONFIG, name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_PROGRAM], |
|
|
|
|
|
P.VAL_UTIL, P.VAL_CONFIG, name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_ENV], |
|
|
|
|
|
job.par.environment, P.VAL_CONFIG, P.KEY_TOOL+"_"+ name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
raise Exception(P.EXP_CONFIG_MISSING, modul+", "+name) |
|
|
|
|
|
elif modul == P.KEY_COMP: |
|
|
elif modul == P.KEY_COMP: |
|
|
for format in CONFIG_FORMAT: |
|
|
for format in CONFIG_FORMAT: |
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_HOME], |
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_HOME], |
|
@ -91,20 +75,87 @@ def getConfigPath(job, modul, name, subname=""): |
|
|
if verify: job.debug(verify, "6 " + pathname) |
|
|
if verify: job.debug(verify, "6 " + pathname) |
|
|
raise Exception(P.EXP_CONFIG_MISSING, modul+", "+name) |
|
|
raise Exception(P.EXP_CONFIG_MISSING, modul+", "+name) |
|
|
elif modul in COMP_FILES: |
|
|
elif modul in COMP_FILES: |
|
|
|
|
|
return getCompPath(job, name, subname, modul) |
|
|
|
|
|
elif modul == P.KEY_BASIC: |
|
|
|
|
|
return getBasicPath(job, name) |
|
|
|
|
|
elif modul == P.KEY_TESTCASE: |
|
|
|
|
|
return getTestPath(job, name, D.DFILE_TESTCASE_NAME) |
|
|
|
|
|
elif modul == P.KEY_TESTSUITE: |
|
|
|
|
|
return getTestPath(job, name, D.DFILE_TESTSUITE_NAME) |
|
|
|
|
|
elif modul == P.KEY_CATALOG: |
|
|
|
|
|
return getCatalogPath(job, name) |
|
|
|
|
|
else: |
|
|
|
|
|
pathname = tools.path_tool.compose_path(job, P.P_TCPARFILE) |
|
|
|
|
|
if verify: job.debug(verify, "7 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
pathname = tools.path_tool.compose_path(job, P.P_TSPARFILE) |
|
|
|
|
|
if verify: job.debug(verify, "8 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
|
|
|
if len(subname) > 1: |
|
|
|
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_RELEASE], |
|
|
|
|
|
P.VAL_CONFIG, "basis."+format) |
|
|
|
|
|
if verify: job.debug(verify, "9 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
|
|
|
if len(subname) > 1: |
|
|
|
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_ENV], |
|
|
|
|
|
P.VAL_CONFIG, "basis."+format) |
|
|
|
|
|
if verify: job.debug(verify, "9 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
|
|
|
if len(subname) > 1: |
|
|
|
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_HOME], |
|
|
|
|
|
P.VAL_CONFIG, "basis."+format) |
|
|
|
|
|
if verify: job.debug(verify, "9 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
raise Exception(P.EXP_CONFIG_MISSING, modul+", "+name) |
|
|
|
|
|
|
|
|
|
|
|
def getToolPath(job, name, subname): |
|
|
|
|
|
if subname != "": |
|
|
|
|
|
envdir = subname |
|
|
|
|
|
elif hasattr(job.par, "environment"): |
|
|
|
|
|
envdir = job.par.environment |
|
|
|
|
|
else: |
|
|
|
|
|
envdir = "xxxxx" |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_ENV], |
|
|
|
|
|
envdir, P.VAL_CONFIG, P.KEY_TOOL + "_" + name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
|
|
|
P.VAL_CONFIG, name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_HOME], |
|
|
|
|
|
P.VAL_CONFIG, name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_PROGRAM], |
|
|
|
|
|
P.VAL_UTIL, P.VAL_CONFIG, name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
raise Exception(P.EXP_CONFIG_MISSING, envdir + ", " + name) |
|
|
|
|
|
|
|
|
|
|
|
def getCompPath(job, name, subname, filename): |
|
|
# for example DATASTRUCURE or the table |
|
|
# for example DATASTRUCURE or the table |
|
|
pathnames = [] |
|
|
pathnames = [] |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
basic.componentHandling.getComponentFolder(name), modul)) |
|
|
basic.componentHandling.getComponentFolder(name), filename)) |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
basic.componentHandling.getComponentFolder(subname), modul)) |
|
|
basic.componentHandling.getComponentFolder(subname), filename)) |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, modul)) |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, filename)) |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, subname)) |
|
|
pathnames.append(os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_PROGRAM], P.VAL_BASIC, subname)) |
|
|
configpath = getExistingPath(job, pathnames) |
|
|
configpath = getExistingPath(job, pathnames) |
|
|
if configpath is not None: |
|
|
if configpath is not None: |
|
|
return configpath |
|
|
return configpath |
|
|
for format in CONFIG_FORMAT: |
|
|
for format in CONFIG_FORMAT: |
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
basic.componentHandling.getComponentFolder(name), modul+"."+format) |
|
|
basic.componentHandling.getComponentFolder(name), filename + "." + format) |
|
|
if os.path.exists(pathname): |
|
|
if os.path.exists(pathname): |
|
|
return pathname |
|
|
return pathname |
|
|
for format in CONFIG_FORMAT: |
|
|
for format in CONFIG_FORMAT: |
|
@ -113,8 +164,10 @@ def getConfigPath(job, modul, name, subname=""): |
|
|
basic.componentHandling.getComponentFolder(name), subname + "." + format) |
|
|
basic.componentHandling.getComponentFolder(name), subname + "." + format) |
|
|
if os.path.exists(pathname): |
|
|
if os.path.exists(pathname): |
|
|
return pathname |
|
|
return pathname |
|
|
raise Exception(P.EXP_CONFIG_MISSING, modul+", "+name) |
|
|
raise Exception(P.EXP_CONFIG_MISSING, filename + ", " + name) |
|
|
elif modul == P.KEY_BASIC: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getBasicPath(job, name): |
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS], |
|
|
P.VAL_CONFIG, name)) |
|
|
P.VAL_CONFIG, name)) |
|
|
if path is not None: |
|
|
if path is not None: |
|
@ -123,21 +176,21 @@ def getConfigPath(job, modul, name, subname=""): |
|
|
P.VAL_CONFIG, name)) |
|
|
P.VAL_CONFIG, name)) |
|
|
if path is not None: |
|
|
if path is not None: |
|
|
return path |
|
|
return path |
|
|
elif modul == P.KEY_TESTCASE: |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
def getTestPath(job, name, filename): |
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA], |
|
|
|
|
|
name, D.DFILE_TESTCASE_NAME + "."+format) |
|
|
|
|
|
if verify: job.debug(verify, "4 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
elif modul == P.KEY_TESTSUITE: |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
for format in CONFIG_FORMAT: |
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA], |
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA], |
|
|
name, D.DFILE_TESTSUITE_NAME + "." + format) |
|
|
name, filename + "." + format) |
|
|
if verify: job.debug(verify, "4 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
if os.path.exists(pathname): |
|
|
return pathname |
|
|
return pathname |
|
|
elif modul == P.KEY_CATALOG: |
|
|
|
|
|
|
|
|
def getCatalogPath(job, name): |
|
|
|
|
|
if hasattr(job, "par") and hasattr(job.par, "project"): |
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA], |
|
|
|
|
|
getattr(job.par, "project"), P.KEY_CATALOG, name)) |
|
|
|
|
|
if path is not None: |
|
|
|
|
|
return path |
|
|
|
|
|
|
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA], |
|
|
path = getExistingPath(job, os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA], |
|
|
P.KEY_CATALOG, name)) |
|
|
P.KEY_CATALOG, name)) |
|
|
if path is not None: |
|
|
if path is not None: |
|
@ -151,37 +204,6 @@ def getConfigPath(job, modul, name, subname=""): |
|
|
if path is not None: |
|
|
if path is not None: |
|
|
return path |
|
|
return path |
|
|
raise Exception(P.EXP_CONFIG_MISSING, name) |
|
|
raise Exception(P.EXP_CONFIG_MISSING, name) |
|
|
else: |
|
|
|
|
|
pathname = tools.path_tool.compose_path(job, P.P_TCPARFILE) |
|
|
|
|
|
if verify: job.debug(verify, "7 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
pathname = tools.path_tool.compose_path(job, P.P_TSPARFILE) |
|
|
|
|
|
if verify: job.debug(verify, "8 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
|
|
|
if len(subname) > 1: |
|
|
|
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_RELEASE], |
|
|
|
|
|
P.VAL_CONFIG, "basis."+format) |
|
|
|
|
|
if verify: job.debug(verify, "9 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
|
|
|
if len(subname) > 1: |
|
|
|
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_ENV], |
|
|
|
|
|
P.VAL_CONFIG, "basis."+format) |
|
|
|
|
|
if verify: job.debug(verify, "9 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
for format in CONFIG_FORMAT: |
|
|
|
|
|
if len(subname) > 1: |
|
|
|
|
|
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_HOME], |
|
|
|
|
|
P.VAL_CONFIG, "basis."+format) |
|
|
|
|
|
if verify: job.debug(verify, "9 " + pathname) |
|
|
|
|
|
if os.path.exists(pathname): |
|
|
|
|
|
return pathname |
|
|
|
|
|
raise Exception(P.EXP_CONFIG_MISSING, modul+", "+name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getConfValue(attribute, comp): |
|
|
def getConfValue(attribute, comp): |
|
@ -223,12 +245,12 @@ def hasAttr(o, name): |
|
|
|
|
|
|
|
|
def getConfig(job, modul, name, subname=""): |
|
|
def getConfig(job, modul, name, subname=""): |
|
|
if job is None: |
|
|
if job is None: |
|
|
verify = 24 |
|
|
verify = 0 |
|
|
else: |
|
|
else: |
|
|
verify = job.getDebugLevel("config_tool")-4 |
|
|
verify = job.getDebugLevel("config_tool") |
|
|
msg = None |
|
|
msg = None |
|
|
if hasattr(job, "m"): msg = job.m |
|
|
if hasattr(job, "m"): msg = job.m |
|
|
pathname = getConfigPath(job, modul, name, subname) |
|
|
pathname = select_config_path(job, modul, name, subname) |
|
|
confs = {} |
|
|
confs = {} |
|
|
job.debug(verify, "getConfig " + pathname) |
|
|
job.debug(verify, "getConfig " + pathname) |
|
|
if len(pathname) < 1: |
|
|
if len(pathname) < 1: |
|
|