Marc/Mentat related things are only executed for filetype marc. this has been too lax before, causing trouble.

filetype is now lowercased right from the start, keeping effort low downstream...
This commit is contained in:
Philip Eisenlohr 2011-03-10 09:45:57 +00:00
parent 6475235fb4
commit 621c1198a4
1 changed files with 33 additions and 28 deletions

View File

@ -383,12 +383,12 @@ def OpenPostfile(name,type):
p = {\ p = {\
'spectral': MPIEspectral_result,\ 'spectral': MPIEspectral_result,\
'marc': post_open,\ 'marc': post_open,\
}[type.lower()]\ }[type]\
(name+ (name+
{\ {\
'marc': '.t16',\ 'marc': '.t16',\
'spectral': '.spectralOut',\ 'spectral': '.spectralOut',\
}[type.lower()] }[type]
) )
p.extrapolation('translate') p.extrapolation('translate')
p.moveto(1) p.moveto(1)
@ -627,33 +627,36 @@ parser.set_defaults(separateFiles = False)
(options, file) = parser.parse_args() (options, file) = parser.parse_args()
options.filetype = options.filetype.lower()
try: if options.filetype == 'marc':
default = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0]))) try:
MSCpath = os.path.normpath(default.readline().strip()) file = open('%s/../MSCpath'%os.path.dirname(os.path.realpath(sys.argv[0])))
default.close() MSCpath = os.path.normpath(file.readline().strip())
except: file.close()
MSCpath = '/msc' except:
MSCpath = '/msc'
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
try:
from py_post import *
except:
print('error: no valid Mentat release found in %s'%MSCpath)
sys.exit(-1)
else:
def post_open():
return
for release,subdirs in sorted(releases.items(),reverse=True):
for subdir in subdirs:
libPath = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir)
if os.path.exists(libPath):
sys.path.append(libPath)
break
else:
continue
break
try:
from py_post import *
except:
if options.filetype.lower() == 'marc':
print('no valid Mentat release found in %s'%MSCpath)
sys.exit(-1)
else:
def post_open():
return True
bg = backgroundMessage() bg = backgroundMessage()
bg.start() bg.start()
@ -669,7 +672,7 @@ if not os.path.exists(file[0]):
parser.print_help() parser.print_help()
parser.error('invalid file "%s" specified...'%file[0]) parser.error('invalid file "%s" specified...'%file[0])
if options.filetype.lower() not in ['marc','spectral']: if options.filetype not in ['marc','spectral']:
parser.print_help() parser.print_help()
parser.error('file type "%s" not supported...'%options.filetype) parser.error('file type "%s" not supported...'%options.filetype)
@ -725,7 +728,9 @@ for opt in ['nodalScalar','elementalScalar','elementalTensor','homogenizationRes
# --- output info # --- output info
if options.info: if options.info:
print '\nMentat release %s\n'%release if options.filetype == 'marc':
print '\nMentat release %s\n'%release
SummarizePostfile(stat,sys.stderr) SummarizePostfile(stat,sys.stderr)
print '\nUser Defined Outputs' print '\nUser Defined Outputs'