2009-03-23 21:38:17 +05:30
|
|
|
#!/usr/bin/env python
|
2009-08-31 20:39:15 +05:30
|
|
|
# $Id$
|
2009-03-23 21:38:17 +05:30
|
|
|
import os,sys
|
|
|
|
|
2009-08-26 12:58:43 +05:30
|
|
|
sys.argv += ['' for i in range(2 - len(sys.argv))]
|
2009-03-23 21:38:17 +05:30
|
|
|
architectures = {
|
|
|
|
'marc': {
|
|
|
|
'parent': 'mpie_cpfem_marc.f90',
|
2009-08-26 12:58:43 +05:30
|
|
|
'versions' : ['%%MARCVERSION%%','2007r1','2008r1'],
|
|
|
|
'substitutions' : {'%%REVISION%%': sys.argv[1],},
|
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-08-26 12:58:43 +05:30
|
|
|
parentFile = open(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:]:
|
|
|
|
childFile = open(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
|
|
|
for substitution in me['substitutions']:
|
|
|
|
line = line.replace(substitution,me['substitutions'][substitution])
|
|
|
|
childFile.write(line.replace(me['versions'][0],version))
|
2009-03-23 21:38:17 +05:30
|
|
|
childFile.close()
|