version 1.6, 2013/11/13 17:26:27
|
version 1.12, 2013/11/22 01:58:25
|
Line 42 PERL_FXNS_A = """sub new |
|
Line 42 PERL_FXNS_A = """sub new |
|
}; | }; |
| |
bless($self, $clname); | bless($self, $clname); |
$self->{_paramsH} = $self->initialize(); |
$self->{_paramsH} = {}; |
|
$self->initialize(); |
| |
return $self; | return $self; |
} | } |
Line 259 def processParam(cfgfile, line, regexpQu |
|
Line 260 def processParam(cfgfile, line, regexpQu |
|
# constants (the names of which are the parameter names) | # constants (the names of which are the parameter names) |
# we can refer to those in the init section. The key variable holds the | # we can refer to those in the init section. The key variable holds the |
# name of the constant. | # name of the constant. |
perlInitSection.extend(list('\n $self->{_paramsH}->{' + key + '} = ' + "'" + val + "';")) |
perlInitSection.extend(list("\n $self->{_paramsH}->{'" + key + "'} = " + key + ';')) |
else: | else: |
# No quote qualifier | # No quote qualifier |
raise Exception('missingQuoteQual', key) | raise Exception('missingQuoteQual', key) |
Line 370 def parseConfig(fin, keymap, addenda, de |
|
Line 371 def parseConfig(fin, keymap, addenda, de |
|
regexpCustMkBeg = re.compile(r"^_CUST_") | regexpCustMkBeg = re.compile(r"^_CUST_") |
regexpCustMkEnd = re.compile(r"^_ENDCUST_") | regexpCustMkEnd = re.compile(r"^_ENDCUST_") |
regexpDiv = re.compile(r"^__") | regexpDiv = re.compile(r"^__") |
regexp = re.compile(r"^\s*(\S+)\s+(\S+)") |
regexp = re.compile(r"^\s*(\S+)\s+(\S.*)") |
| |
platDict = {} | platDict = {} |
machDict = {} | machDict = {} |
Line 395 def parseConfig(fin, keymap, addenda, de |
|
Line 396 def parseConfig(fin, keymap, addenda, de |
|
section = newSection | section = newSection |
| |
if section == 'make': | if 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. |
matchobj = regexpCustMkBeg.match(line) | matchobj = regexpCustMkBeg.match(line) |
Line 416 def parseConfig(fin, keymap, addenda, de |
|
Line 418 def parseConfig(fin, keymap, addenda, de |
|
ppRet = processParam(iscfg, line, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, platDict, machDict, section) | ppRet = processParam(iscfg, line, regexpQuote, regexp, keymap, defs, cDefs, mDefsGen, mDefsMake, perlConstSection, perlInitSection, platDict, machDict, section) |
| |
if ppRet: | if ppRet: |
break; |
break |
elif section == 'projcfg': | elif section == 'projcfg': |
# Copy the line ver batim to the projCfg list (configure) | # Copy the line ver batim to the projCfg list (configure) |
for line in fin: | for line in fin: |
Line 509 def parseConfig(fin, keymap, addenda, de |
|
Line 511 def parseConfig(fin, keymap, addenda, de |
|
if not rv: | if not rv: |
for mach in machDict: | for mach in machDict: |
mDefsMake.extend(list('\nifeq ($(MACHTYPE), ' + mach + ')')) | mDefsMake.extend(list('\nifeq ($(MACHTYPE), ' + mach + ')')) |
for var in platDict[plat]: |
for var in machDict[mach]: |
mDefsMake.extend(list('\n' + var + ' = ' + platDict[plat][var])) |
mDefsMake.extend(list('\n' + var + ' = ' + machDict[mach][var])) |
mDefsMake.extend(list('\nendif\n')) | mDefsMake.extend(list('\nendif\n')) |
|
|
return rv | return rv |
| |
def getMgrUIDLine(defs, uidParam): | def getMgrUIDLine(defs, uidParam): |
Line 553 def configureComps(defs, mDefs): |
|
Line 554 def configureComps(defs, mDefs): |
|
hasgfort = bool(0) | hasgfort = bool(0) |
| |
# Try icc. | # Try icc. |
cmd = 'icc -V 2>&1' |
cmd = 'icc --version 2>&1' |
try: | try: |
ret = check_output(cmd, shell=True) | ret = check_output(cmd, shell=True) |
ret = ret.decode("utf-8") | ret = ret.decode("utf-8") |
Line 562 def configureComps(defs, mDefs): |
|
Line 563 def configureComps(defs, mDefs): |
|
rv = bool(1) | rv = bool(1) |
| |
if not rv: | if not rv: |
regexp = re.compile(r".+Version\s+(\d+)[.](\d+)", re.DOTALL) |
regexp = re.compile(r"\s*\S+\s+\S+\s+(\d+)[.](\d+)", re.DOTALL) |
matchobj = regexp.match(ret) | matchobj = regexp.match(ret) |
if matchobj is None: | if matchobj is None: |
raise Exception('unexpectedIccRet', ret) | raise Exception('unexpectedIccRet', ret) |
Line 594 def configureComps(defs, mDefs): |
|
Line 595 def configureComps(defs, mDefs): |
|
hasgcc = bool(1) | hasgcc = bool(1) |
| |
# Try ifort. | # Try ifort. |
cmd = 'ifort -V 2>&1' |
cmd = 'ifort --version 2>&1' |
try: | try: |
ret = check_output(cmd, shell=True) | ret = check_output(cmd, shell=True) |
ret = ret.decode("utf-8") | ret = ret.decode("utf-8") |
Line 603 def configureComps(defs, mDefs): |
|
Line 604 def configureComps(defs, mDefs): |
|
rv = bool(1) | rv = bool(1) |
| |
if not rv: | if not rv: |
regexp = re.compile(r".+Version\s+(\d+)\.(\d+)", re.DOTALL) |
regexp = re.compile(r"\s*\S+\s+\S+\s+(\d+)\.(\d+)", re.DOTALL) |
matchobj = regexp.match(ret) | matchobj = regexp.match(ret) |
if matchobj is None: | if matchobj is None: |
raise Exception('unexpectedIfortRet', ret) | raise Exception('unexpectedIfortRet', ret) |
Line 651 def configureComps(defs, mDefs): |
|
Line 652 def configureComps(defs, mDefs): |
|
mDefs.extend(list('\nFCOMPILER = gfortran')) | mDefs.extend(list('\nFCOMPILER = gfortran')) |
| |
# Environment overrides. These get written, regardless of the disposition of auto-configuration. | # Environment overrides. These get written, regardless of the disposition of auto-configuration. |
mDefs.extend(list('\nifneq $(JSOC_COMPILER,)\n COMPILER = $(JSOC_COMPILER)\nendif')) |
mDefs.extend(list('\nifneq ($(JSOC_COMPILER),)\n COMPILER = $(JSOC_COMPILER)\nendif')) |
mDefs.extend(list('\nifneq $(JSOC_FCOMPILER,)\n FCOMPILER = $(JSOC_FCOMPILER)\nendif')) |
mDefs.extend(list('\nifneq ($(JSOC_FCOMPILER),)\n FCOMPILER = $(JSOC_FCOMPILER)\nendif')) |
| |
return rv | return rv |
| |
Line 734 def writeProjFiles(pCfile, pMfile, pRfil |
|
Line 735 def writeProjFiles(pCfile, pMfile, pRfil |
|
rv = bool(1) | rv = bool(1) |
| |
if not rv: | if not rv: |
|
if os.path.exists(pCfile): |
try: | try: |
os.chmod(pCfile, stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH) | os.chmod(pCfile, stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH) |
except OSError as exc: | except OSError as exc: |
|
type, value, traceback = sys.exc_info() |
|
print('Unable to chmod file ' + "'" + value.filename + "'.", file=sys.stderr) |
print(exc.strerror, file=sys.stderr) | print(exc.strerror, file=sys.stderr) |
rv = bool(1) | rv = bool(1) |
| |
Line 782 def configureNet(cfgfile, cfile, mfile, |
|
Line 786 def configureNet(cfgfile, cfile, mfile, |
|
rv = getMgrUIDLine(defs, uidParam) | rv = getMgrUIDLine(defs, uidParam) |
if rv == bool(0): | if rv == bool(0): |
rv = parseConfig(None, keymap, uidParam, defs, cDefs, mDefsGen, None, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection) | rv = parseConfig(None, keymap, uidParam, defs, cDefs, mDefsGen, None, projCfg, projMkRules, projRules, projTarget, perlConstSection, perlInitSection) |
|
|
# Configure the compiler-selection make variables. | # Configure the compiler-selection make variables. |
if not rv: | if not rv: |
rv = configureComps(defs, mDefsComps) | rv = configureComps(defs, mDefsComps) |
Line 790 def configureNet(cfgfile, cfile, mfile, |
|
Line 793 def configureNet(cfgfile, cfile, mfile, |
|
# Write out the parameter files. | # Write out the parameter files. |
if not rv: | if not rv: |
rv = writeParamsFiles(base, cfile, mfile, pfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection) | rv = writeParamsFiles(base, cfile, mfile, pfile, cDefs, mDefsGen, mDefsMake, mDefsComps, perlConstSection, perlInitSection) |
|
|
# Write out the project-specific make files (make_basic.mk, Rules.mk, and target.mk). | # Write out the project-specific make files (make_basic.mk, Rules.mk, and target.mk). |
if not rv: | if not rv: |
rv = writeProjFiles(pCfile, pMfile, pRfile, pTfile, projCfg, projMkRules, projRules, projTarget) | rv = writeProjFiles(pCfile, pMfile, pRfile, pTfile, projCfg, projMkRules, projRules, projTarget) |
|
|
except IOError as exc: | except IOError as exc: |
print(exc.strerror, file=sys.stderr) | print(exc.strerror, file=sys.stderr) |
print('Unable to read configuration file ' + cfgfile + '.', file=sys.stderr) | print('Unable to read configuration file ' + cfgfile + '.', file=sys.stderr) |
Line 950 if rv == RET_SUCCESS: |
|
Line 951 if rv == RET_SUCCESS: |
|
# SUMS manager (it is in the configuration file) | # SUMS manager (it is in the configuration file) |
configureNet(NET_CFG, cfile, mfile, pfile, pCfile, pMfile, pRfile, pTfile, optD['base'], keymap) | configureNet(NET_CFG, cfile, mfile, pfile, pCfile, pMfile, pRfile, pTfile, optD['base'], keymap) |
else: | else: |
|
# A Stanford user can override the parameters in configsdp.txt by copying that file to config.local, |
|
# and then editing config.local. So, if config.local exists, use that. |
|
if os.path.isfile(cdir + '/' + NET_CFG): |
|
configureSdp(NET_CFG, cfile, mfile, pfile, pCfile, pMfile, pRfile, pTfile, optD['base']) |
|
else: |
configureSdp(SDP_CFG, cfile, mfile, pfile, pCfile, pMfile, pRfile, pTfile, optD['base']) | configureSdp(SDP_CFG, cfile, mfile, pfile, pCfile, pMfile, pRfile, pTfile, optD['base']) |
|
|
|
|
|
|