7 from ConfigParser
import *
17 ConfigParser.__init__(self)
25 sections = self.sections()
26 fixedsections = [
'General',
'JobType',
'Data',
'Site',
'User',
'Debug']
29 outlines.append(
'from WMCore.Configuration import Configuration \n')
30 outlines.append(
'config = Configuration()')
32 for fixedsection
in fixedsections:
33 if fixedsection
in sections:
35 sections.remove(fixedsection)
37 for section
in sections:
40 with open(filename,
'wb')
as outfile:
41 outfile.write(
'\n'.
join(outlines) +
'\n')
51 sectionLines.append(
'\nconfig.section_("%s")'%section)
52 configItems = self.items(section)
53 for configItem
in configItems:
54 if not isinstance(configItem[1], str):
55 sectionLines.append(
'config.%s.%s = %s'%(section,configItem[0],configItem[1]))
56 elif "True" in configItem[1]
or "False" in configItem[1]:
57 sectionLines.append(
'config.%s.%s = %s'%(section,configItem[0],configItem[1]))
60 if configItem[0]==
"runRange" :
61 sectionLines.append(
'config.%s.%s = \'%s\''%(section,configItem[0],configItem[1]))
65 sectionLines.append(
'config.%s.%s = %d'%(section,configItem[0],
int(configItem[1])))
71 sectionLines.append(
'config.%s.%s = %.2f'%(section,configItem[0],
float(configItem[1])))
76 if isinstance(configItem[1], list):
77 sectionLines.append(
'config.%s.%s = %s'%(section,configItem[0],
str(configItem[1])))
80 sectionLines.append(
'config.%s.%s = \'%s\''%(section,configItem[0],configItem[1]))
def writeCrabConfig(self, filename)
Write CrabConfigParser object to file self: CrabConfigParser.
def getSectionLines(self, section)
Helper function to retrieve crab config output lines for one section self: CrabConfigParser.
static std::string join(char **cmd)
def __init__(self)
The constructor.
The CrabConfigParser class.