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': {
|
|
|
|
'parent': 'mpie_cpfem_marc.f90',
|
2010-04-28 12:58:12 +05:30
|
|
|
'versions' : ['%%MARCVERSION%%','2007r1','2008r1','2010'],
|
2009-03-23 21:38:17 +05:30
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2009-10-12 19:48:54 +05:30
|
|
|
wd = os.path.dirname(sys.argv[0])
|
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()
|