23 """take a line and a corresponding comment and prepare the replaceDict such that it can be found again in the python version """
24 allKeywords = [
'module',
'int32',
'vint32',
'uint32',
'vuint32',
'double',
'vdouble',
'InputTag',
'VInputTag',
'PSet',
'VPSet',
'string',
'vstring',
'bool',
'vbool',
'path',
'sequence',
'schedule',
'endpath',
'es_source',
'es_module',
'block',
'FileInPath']
25 unnamedKeywords = [
'es_source',
'es_module']
28 words = line.lstrip().
split()
32 if firstWord
in allKeywords
and len(words) > 2
and words[2] ==
'=':
33 tokenInPython = words[1] +
" = "
34 replaceDict[tokenInPython] = comment
35 elif firstWord ==
'untracked' and len(words) > 3
and words[1]
in allKeywords
and words[3] ==
'=':
36 tokenInPython = words[2] +
" = cms.untracked"
37 replaceDict[tokenInPython] = comment
38 elif firstWord.startswith(
'include'):
40 pythonModule = pythonModule.replace(
"/",
".").
replace(
"python.",
"").
replace(
".py",
"")
41 tokenInPython =
"from "+pythonModule
42 tokenInPython = tokenInPython.replace(
"/",
".").
replace(
"python.",
"").
replace(
".py",
"")
43 replaceDict[tokenInPython] = comment
45 tokenInPython =
"process.load(\""+pythonModule
46 replaceDict[tokenInPython] = comment
47 elif firstWord ==
'source' and len(words) > 1
and words[1] ==
'=':
48 replaceDict[
'source = '] = comment
49 elif firstWord
in unnamedKeywords
and len(words) > 2
and words[1] ==
'=':
50 tokenInPython = words[2] +
' = cms.ES'
51 replaceDict[tokenInPython] = comment
52 elif firstWord ==
'replace' and len(words) > 2
and words[2] ==
'=':
53 tokenInPython= words[1] +
" = "
54 replaceDict[tokenInPython] = comment
55 elif firstWord ==
'replace' and len(words) > 2
and words[2] ==
'=':
56 tokenInPython= words[1] +
" = "
57 replaceDict[tokenInPython] = comment
59 tokenInPython =
'process.'+tokenInPython
60 replaceDict[tokenInPython] = comment
61 elif firstWord ==
'using' and len(words) == 2:
62 tokenInPython= words[1]
63 replaceDict[tokenInPython] = comment
66 replaceDict[
"@beginning"] +=
"\n"+comment.value