version 1.26, 2016/09/23 16:38:30
|
version 1.27, 2017/09/13 17:46:15
|
Line 447 def processXML(xml, projRules, projTarge |
|
Line 447 def processXML(xml, projRules, projTarge |
|
| |
return rv | return rv |
| |
def determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg): |
def determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg): |
|
matchobj = regexpStyle.match(line) |
|
if matchobj: |
|
return 'style' |
|
|
matchobj = regexpDefs.match(line) | matchobj = regexpDefs.match(line) |
if not matchobj is None: | if not matchobj is None: |
return 'defs' | return 'defs' |
Line 481 def parseConfig(fin, keymap, addenda, de |
|
Line 485 def parseConfig(fin, keymap, addenda, de |
|
# Open required config file (config.local) | # Open required config file (config.local) |
try: | try: |
# Examine each line, looking for key=value pairs. | # Examine each line, looking for key=value pairs. |
|
regexpStyle = re.compile(r"^__STYLE__") |
regexpDefs = re.compile(r"^__DEFS__") | regexpDefs = re.compile(r"^__DEFS__") |
regexpMake = re.compile(r"^__MAKE__") | regexpMake = re.compile(r"^__MAKE__") |
regexpProjMkRules = re.compile(r"__PROJ_MK_RULES__") | regexpProjMkRules = re.compile(r"__PROJ_MK_RULES__") |
Line 494 def parseConfig(fin, keymap, addenda, de |
|
Line 499 def parseConfig(fin, keymap, addenda, de |
|
regexpDiv = re.compile(r"^__") | regexpDiv = re.compile(r"^__") |
regexp = re.compile(r"^\s*(\S+)\s+(\S.*)") | regexp = re.compile(r"^\s*(\S+)\s+(\S.*)") |
| |
|
ignoreKeymap = False |
platDict = {} | platDict = {} |
machDict = {} | machDict = {} |
| |
Line 512 def parseConfig(fin, keymap, addenda, de |
|
Line 518 def parseConfig(fin, keymap, addenda, de |
|
# Skip whitespace line | # Skip whitespace line |
continue | continue |
| |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
| |
if section == 'make': |
if not section: |
|
raise Exception('invalidConfigFile', 'line ' + line.strip() + ' is not in any section') |
|
|
|
if section == 'style': |
|
# if the config.local file has new in the __STYLE__ section, then ignore the keymap and treat config.local like configsdp.txt; |
|
# do not map from NetDRMS config.local parameter names to configsdp.txt names |
|
for line in fin: |
|
matchobj = regexpDiv.match(line) |
|
if matchobj: |
|
break; |
|
if line.strip(' \n').lower() == 'new' and keymap: |
|
ignoreKeymap = True |
|
|
|
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
|
if not newSection is None: |
|
section = newSection |
|
continue |
|
elif section == 'make': |
| |
# There are some blocks of lines in the __MAKE__ section that must be copied ver batim to the output make file. | # There are some blocks of lines in the __MAKE__ section that must be copied ver batim to the output make file. |
# The blocks are defined by _CUST_/_ENDCUST_ tags. | # The blocks are defined by _CUST_/_ENDCUST_ tags. |
Line 529 def parseConfig(fin, keymap, addenda, de |
|
Line 552 def parseConfig(fin, keymap, addenda, de |
|
if not matchobj is None: | if not matchobj is None: |
break; | break; |
mDefsMake.extend(list(line)) | mDefsMake.extend(list(line)) |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
continue | continue |
# Intentional fall through to next if statement | # Intentional fall through to next if statement |
if section == 'defs' or section == 'make': | if section == 'defs' or section == 'make': |
iscfg = bool(1) | iscfg = bool(1) |
ppRet = processParam(iscfg, line, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection, platDict, machDict, section) |
if ignoreKeymap: |
|
keymapActual = None |
|
else: |
|
keymapActual = keymap |
|
ppRet = processParam(iscfg, line, regexpQuote, regexp, keymapActual, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection, platDict, machDict, section) |
| |
if ppRet: | if ppRet: |
break | break |
Line 547 def parseConfig(fin, keymap, addenda, de |
|
Line 574 def parseConfig(fin, keymap, addenda, de |
|
if not matchobj is None: | if not matchobj is None: |
break; | break; |
projCfg.extend(list(line)) | projCfg.extend(list(line)) |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
continue | continue |
Line 558 def parseConfig(fin, keymap, addenda, de |
|
Line 585 def parseConfig(fin, keymap, addenda, de |
|
if not matchobj is None: | if not matchobj is None: |
break; | break; |
projMkRules.extend(list(line)) | projMkRules.extend(list(line)) |
newSection = determineSection(line, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
newSection = determineSection(line, regexpStyle, regexpDefs, regexpMake, regexpProjMkRules, regexpProj, regexpProjCfg) |
if not newSection is None: | if not newSection is None: |
section = newSection | section = newSection |
continue | continue |
Line 580 def parseConfig(fin, keymap, addenda, de |
|
Line 607 def parseConfig(fin, keymap, addenda, de |
|
else: | else: |
# re-raise the exception | # re-raise the exception |
raise | raise |
if msg == 'badKeyMapKey': |
|
|
if msg == 'invalidConfigFile': |
|
violator = exc.args[1] |
|
print(violator, file=sys.stderr) |
|
rv = bool(1) |
|
elif msg == 'badKeyMapKey': |
# If we are here, then there was a non-empty keymap, and the parameter came from | # If we are here, then there was a non-empty keymap, and the parameter came from |
# the configuration file. | # the configuration file. |
violator = exc.args[1] | violator = exc.args[1] |
Line 619 def parseConfig(fin, keymap, addenda, de |
|
Line 651 def parseConfig(fin, keymap, addenda, de |
|
iscfg = bool(0) | iscfg = bool(0) |
for key in addenda: | for key in addenda: |
item = key + ' ' + addenda[key] | item = key + ' ' + addenda[key] |
ppRet = processParam(iscfg, item, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection, platDict, machDict, 'defs') |
if ignoreKeymap: |
|
keymapActual = None |
|
else: |
|
keymapActual = keymap |
|
ppRet = processParam(iscfg, item, regexpQuote, regexp, keymapActual, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, pyConstSection, pyInitSection, shConstSection, platDict, machDict, 'defs') |
if ppRet: | if ppRet: |
break; | break; |
| |