DAMASK_EICMD/code/setup/setup_code.py

37 lines
1.0 KiB
Python
Raw Normal View History

#!/usr/bin/env python
# $Id$
# Writes version specific files for different MARC releases
import os,sys
architectures = {
'marc': {
2011-05-11 22:10:51 +05:30
'parent': 'DAMASK_marc.f90',
'versions' : ['%%MARCVERSION%%','2007r1','2008r1','2010'],
},
}
wd = os.path.join(os.path.dirname(sys.argv[0]),'..')
for arch in architectures:
me = architectures[arch]
try:
parentFile = open(wd+os.sep+me['parent'])
parentContent = parentFile.readlines()
parentFile.close()
except IOError:
print 'unable to open',me['parent']
continue
for version in me['versions'][1:]:
childFile = open(wd+os.sep+version.join(os.path.splitext(me['parent'])),'w')
for line in parentContent:
childFile.write(line.replace(me['versions'][0],version))
childFile.close()
2011-05-11 22:15:37 +05:30
if raw_input("Do you want to compile the spectral code now? (y/n)") is 'y':
os.system('make --directory %s'%wd)
2011-06-14 20:26:10 +05:30
if '--clean' in [s.lower() for s in sys.argv]:
2011-06-14 20:26:10 +05:30
os.system('make --directory %s clean'%wd)