Repository navigation
Existing local relative path for reference files is not resolved #66
Description
I currently run the CI on my PC and the reference files are placed in a directory that has the following relative path starting from the python script directory:
../../LibRefResults/zLibTest2
my config file is the following:
[
{
"library":"zLibTest2",
"referenceFiles":"../../LibRefResults/zLibTest2"
}
]
When I run the script the relative path is not resolved and it is copied "as is" in the .json file that is used by the testModel.py script, with the result that the reference variables are not found by omc.
It seems that the cause of this is the following code recently added to the test.py script:
if isinstance(c["referenceFiles"], (str, bytes)):
m = re.search("^[$][A-Z]+", c["referenceFiles"])
if m:
k = m.group(0)[1:]
if k not in os.environ:
raise Exception("Environment variable %s not defined, but used in JSON config for reference files" % k)
c["referenceFiles"] = c["referenceFiles"].replace(m.group(0), os.environ[k])
that refuses my path because it is a string that not respect the requirments of the regular expression (i.e., is is not an environment variable)
I think there might be an error in the indentation of the second elif case:
if isinstance(c["referenceFiles"], (str, bytes)):
m = re.search("^[$][A-Z]+", c["referenceFiles"])
if m:
k = m.group(0)[1:]
if k not in os.environ:
raise Exception("Environment variable %s not defined, but used in JSON config for reference files" % k)
c["referenceFiles"] = c["referenceFiles"].replace(m.group(0), os.environ[k])
elif "giturl" in c["referenceFiles"]:
refFilesGitTag = "origin/master"
if "git-ref" in c["referenceFiles"]:
refFilesGitTag = c["referenceFiles"]["git-ref"].strip()
.... etc
that never is tested if c["referenceFiles"] is a string, maybe the right indentation is the following,
if isinstance(c["referenceFiles"], (str, bytes)):
m = re.search("^[$][A-Z]+", c["referenceFiles"])
if m:
k = m.group(0)[1:]
if k not in os.environ:
raise Exception("Environment variable %s not defined, but used in JSON config for reference files" % k)
c["referenceFiles"] = c["referenceFiles"].replace(m.group(0), os.environ[k])
elif "giturl" in c["referenceFiles"]:
refFilesGitTag = "origin/master"
if "git-ref" in c["referenceFiles"]:
refFilesGitTag = c["referenceFiles"]["git-ref"].strip()
.... etc
that probably solves also this issue.
Activity
[-]existing local path for reference files not accepted[/-][+]Existing local relative path for reference files is not accepted[/+][-]Existing local relative path for reference files is not accepted[/-][+]Existing local relative path for reference files is not resolved[/+]