10 parser =
argparse.ArgumentParser(description=
'Take card file, blank all INFI directives and insert the INFI directives from the modifier file instead.',
14 parser.add_argument(
'inCfg', action=
'store',
15 help=
'name of the config-template')
16 parser.add_argument(
'modCfg', action=
'store',
17 help=
'name of the modifier file from mps_split')
18 parser.add_argument(
'outCfg', action=
'store',
19 help=
'name of modified output file')
20 parser.add_argument(
'isn', action=
'store',
21 help=
'number of the job (three digit number with leading zeros)')
24 args = parser.parse_args()
32 with open(inCfg,
'r') as INFILE: 36 with open(modCfg,
'r') as MODFILE: 41 fileNames = mods.split(
'\n')
42 if 'CastorPool=' in fileNames[0]:
46 body = re.sub(re.compile(
'ISN',re.M), isn, body)
49 with open(outCfg,
'w')
as OUTFILE:
53 numberOfFiles = len(fileNames)
54 numberOfExtends =
int(math.ceil(numberOfFiles/255.))
57 for j
in xrange(numberOfExtends):
58 insertBlock =
"readFiles.extend([\n " 61 while (i<255)
and ((currentStart+i)<numberOfFiles):
62 entry = fileNames[currentStart+i].
strip()
63 if (i==254)
or ((currentStart+i+1)==numberOfFiles):
64 insertBlock +=
"\'"+entry+
"\'])\n" 66 insertBlock +=
"\'"+entry+
"\',\n " 69 for line
in fileinput.input(outCfg, inplace=1):
70 if re.match(
'readFiles\s*=\s*cms.untracked.vstring()',line):