Commit 17aec369 authored by ext-bershanska_a's avatar ext-bershanska_a
Browse files

removed EDIT comments and everything related to copying .tmpl to wd

parent 1f5eec4c
......@@ -23,15 +23,13 @@ def getPaths(path, pattern, name):
return result
def getBaseName(inputfilePath): # EDIT: more flexible (can have several *.data files)
def getBaseName(inputfilePath):
templates = getPaths(inputfilePath, '*.tmpl', 'template')
datafiles = getPaths('.', '*.data', 'data')
name = templates[0].split('/')[-1][:-5] #NOTE: choose first (alphanumeric order) *.tmpl file by default
if os.path.isfile(os.path.join('.',name+'.data')):
return name
datafiles = getPaths('.', '*.data', 'data')
print('Template and data filename do not match, '+name+'.data expected')
sys.exit()
......@@ -109,7 +107,7 @@ def main(argv):
doTest = False
doKeep = False
doNobatch = False
doOptimize = True #NOTE: this flag is opposite of --noopt (I want to optimize by default)
doOptimize = True #NOTE: this flag is opposite of --noopt
queue = ""
info = 6
hypert = 0
......@@ -118,7 +116,7 @@ def main(argv):
inputfilePath = None
baseFileName = None
for arg in argv: #EDIT: reorder for readibility, add --filename and shortcuts
for arg in argv:
if arg.startswith("--help"):
printUsage()
exit()
......@@ -140,15 +138,14 @@ def main(argv):
queue = arg.split("=")[1]
elif arg.startswith("--hypert"):
hypert = int(arg.split("=")[1])
elif arg.startswith("-"): #EDIT: ignore any unknown argument '-', not just arg.startswith("--")
elif arg.startswith("-"):
print(arg,'is not a valid option, see --help for the available options')
exit()
# safety check, EDIT: now for both TEMPLATES and OPTIMIZER
# safety check
if os.getcwd() == os.environ.get('TEMPLATES') or os.getcwd() == os.environ.get('OPTIMIZER'):
print('Working directory is the same as the TEMPLATES or OPTIMIZER directory! This is not allowed... bye!')
sys.exit()
os.system('rm -f tmplbak17.tmpl') # make sure we have no junk around (NOTE: don't create tmplbak17.tmpl)
#EDIT: determine what kind of job should be ran
if doOptimize and os.environ.get('OPTIMIZER'):
......@@ -160,17 +157,13 @@ def main(argv):
doOptimize = False
if os.environ.get('TEMPLATES'):
inputfilePath = os.environ.get('TEMPLATES')
#if not os.path.isfile(inputfilePath + ".tmpl"): #NOTE: Idk why this line is supposed to be here
# os.system('cp ' + inputfilePath + '/*.tmpl .')
# #print('Put .tmpl in local directory')
elif (glob.glob(os.path.join('.','*.tmpl'))):
inputfilePath = '../'
#print('.tmpl found in ./')
else:
print('Template file unknown -> exiting ...')
sys.exit()
#EDIT: check that tmpl and data files can be found or guessed
#check that tmpl and data files can be found or guessed
if not baseFileName:
baseFileName = getBaseName(inputfilePath)
elif not os.path.isfile(os.path.join(inputfilePath,baseFileName+'.tmpl')):
......@@ -179,10 +172,10 @@ def main(argv):
print('baseFileName = '+baseFileName)
dataFile = baseFileName + '.data'
tmplFile = os.path.join(inputfilePath,baseFileName+'.tmpl') #EDIT: .tmpl file is no longer copied to wd
tmplFile = os.path.join(inputfilePath,baseFileName+'.tmpl')
oinpFile = baseFileName + '.in' # the resulting OPAL input file
checkCompat(tmplFile, ['SAMPLE']) #EDIT: check compatibility
checkCompat(tmplFile, ['SAMPLE']) # check compatibility
#create the dictionary
opaldict = OpalDict(dataFile)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment