2009-03-23 21:38:17 +05:30
|
|
|
#!/usr/bin/env python
|
2009-08-31 20:39:15 +05:30
|
|
|
# $Id$
|
2010-02-10 22:10:50 +05:30
|
|
|
# Writes version specific files for different MARC releases
|
2009-03-23 21:38:17 +05:30
|
|
|
import os,sys
|
|
|
|
|
|
|
|
architectures = {
|
|
|
|
'marc': {
|
2011-05-11 22:10:51 +05:30
|
|
|
'parent': 'DAMASK_marc.f90',
|
2010-04-28 12:58:12 +05:30
|
|
|
'versions' : ['%%MARCVERSION%%','2007r1','2008r1','2010'],
|
2009-03-23 21:38:17 +05:30
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2011-03-22 21:12:53 +05:30
|
|
|
wd = os.path.join(os.path.dirname(sys.argv[0]),'..')
|
2011-03-11 14:50:37 +05:30
|
|
|
|
2009-03-23 21:38:17 +05:30
|
|
|
for arch in architectures:
|
2009-08-26 12:58:43 +05:30
|
|
|
me = architectures[arch]
|
2009-03-23 21:38:17 +05:30
|
|
|
try:
|
2009-10-12 19:48:54 +05:30
|
|
|
parentFile = open(wd+os.sep+me['parent'])
|
2009-03-23 21:38:17 +05:30
|
|
|
parentContent = parentFile.readlines()
|
|
|
|
parentFile.close()
|
|
|
|
except IOError:
|
2009-08-26 12:58:43 +05:30
|
|
|
print 'unable to open',me['parent']
|
2009-03-23 21:38:17 +05:30
|
|
|
continue
|
|
|
|
|
2009-08-26 12:58:43 +05:30
|
|
|
|
|
|
|
for version in me['versions'][1:]:
|
2009-10-12 19:48:54 +05:30
|
|
|
childFile = open(wd+os.sep+version.join(os.path.splitext(me['parent'])),'w')
|
2009-03-23 21:38:17 +05:30
|
|
|
for line in parentContent:
|
2009-08-26 12:58:43 +05:30
|
|
|
childFile.write(line.replace(me['versions'][0],version))
|
2009-03-23 21:38:17 +05:30
|
|
|
childFile.close()
|
2011-05-11 22:15:37 +05:30
|
|
|
|
2011-10-27 23:25:42 +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
|
|
|
|
2011-06-15 22:10:34 +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)
|