(file) Return to localize.py CVS log (file) (dir) Up to [Development] / JSOC

Diff for /JSOC/localize.py between version 1.26 and 1.28

version 1.26, 2016/09/23 16:38:30 version 1.28, 2020/02/04 20:57:26
Line 1 
Line 1 
 #!/usr/bin/python  #!/usr/bin/python3
  
 # When run with the -s flag, localize.py configures the SUMS-server component of NetDRMS. # When run with the -s flag, localize.py configures the SUMS-server component of NetDRMS.
 from __future__ import print_function  
 import sys import sys
 import getopt import getopt
 import re import re
Line 11  import filecmp
Line 10  import filecmp
 import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
 from subprocess import check_output, CalledProcessError from subprocess import check_output, CalledProcessError
  
 if sys.version_info < (2, 7):  
     raise Exception("You must run the 2.7 release, or a more recent release, of Python.")  
  
 # Constants # Constants
 VERS_FILE = 'jsoc_version.h' VERS_FILE = 'jsoc_version.h'
Line 447  def processXML(xml, projRules, projTarge
Line 444  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 482  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 496  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 515  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 549  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 571  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 582  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 604  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 648  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;
  
Line 770  def configureComps(defs, mDefs):
Line 803  def configureComps(defs, mDefs):
             rv = bool(1)             rv = bool(1)
         elif hasicc:         elif hasicc:
             mDefs.extend(list('\nCOMPILER = icc'))             mDefs.extend(list('\nCOMPILER = icc'))
               # mDefs.extend(list('\nICC_VERSION = blah'))
         else:         else:
             mDefs.extend(list('\nCOMPILER = gcc'))             mDefs.extend(list('\nCOMPILER = gcc'))
  


Legend:
Removed from v.1.26  
changed lines
  Added in v.1.28

Karen Tian
Powered by
ViewCVS 0.9.4