compiling DAMASK_Spectral split seperately from setup_code.py
This commit is contained in:
parent
5228af627c
commit
c816d5ca74
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python
|
||||
import os,string,re,damask
|
||||
from optparse import OptionParser, OptionGroup, Option, SUPPRESS_HELP
|
||||
|
||||
# -----------------------------
|
||||
class extendedOption(Option):
|
||||
# -----------------------------
|
||||
# used for definition of new option parser action 'extend', which enables to take multiple option arguments
|
||||
# taken from online tutorial http://docs.python.org/library/optparse.html
|
||||
|
||||
ACTIONS = Option.ACTIONS + ("extend",)
|
||||
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
|
||||
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
|
||||
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
|
||||
|
||||
def take_action(self, action, dest, opt, value, values, parser):
|
||||
if action == "extend":
|
||||
lvalue = value.split(",")
|
||||
values.ensure_value(dest, []).extend(lvalue)
|
||||
else:
|
||||
Option.take_action(self, action, dest, opt, value, values, parser)
|
||||
|
||||
|
||||
parser = OptionParser(option_class=extendedOption, usage='%prog [options] datafile[s]', description = """
|
||||
Writes version specific files for different MARC releases, adjustes the make file for the spectral solver and optionally compiles the spectral solver
|
||||
|
||||
""" + string.replace('$Id: setup_code.py 1908 2012-11-14 09:57:18Z MPIE\p.eisenlohr $','\n','\\n')
|
||||
)
|
||||
|
||||
parser.add_option('-c', '--compile', dest='spectralCompile', action='store_true', \
|
||||
help='compiles the spectral solver [%default]')
|
||||
parser.add_option('-o', '--options', dest='makeOptions', action='extend', type='string', \
|
||||
metavar="KEY=VALUE", \
|
||||
help='comma-separated list of options passed to Makefile when compiling spectral code %default')
|
||||
parser.set_defaults(spectralCompile = True)
|
||||
parser.set_defaults(makeOptions = ['F90=ifort'])
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
damaskEnv = damask.Environment('../../') # script location relative to root
|
||||
baseDir = damaskEnv.relPath('code/')
|
||||
|
||||
|
||||
# compiling spectral code
|
||||
if (options.spectralCompile):
|
||||
print 'base directory', baseDir
|
||||
os.system('make --directory %s clean'%(baseDir))
|
||||
print options.makeOptions
|
||||
os.system('make --directory %s %s'%(baseDir,' '.join(options.makeOptions)))
|
Loading…
Reference in New Issue