From 02602144d208aa06d7ca6bbfc9c7f6f898ef1534 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 12 Oct 2009 14:18:54 +0000 Subject: [PATCH] can now be executed from different directories...but will operate on "its" one --- code/makeMe.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/code/makeMe.py b/code/makeMe.py index 7b41433ce..e60265475 100755 --- a/code/makeMe.py +++ b/code/makeMe.py @@ -2,19 +2,18 @@ # $Id$ import os,sys -sys.argv += ['' for i in range(2 - len(sys.argv))] architectures = { 'marc': { 'parent': 'mpie_cpfem_marc.f90', 'versions' : ['%%MARCVERSION%%','2007r1','2008r1'], - 'substitutions' : {'%%REVISION%%': sys.argv[1],}, }, } +wd = os.path.dirname(sys.argv[0]) for arch in architectures: me = architectures[arch] try: - parentFile = open(me['parent']) + parentFile = open(wd+os.sep+me['parent']) parentContent = parentFile.readlines() parentFile.close() except IOError: @@ -23,9 +22,7 @@ for arch in architectures: for version in me['versions'][1:]: - childFile = open(version.join(os.path.splitext(me['parent'])),'w') + childFile = open(wd+os.sep+version.join(os.path.splitext(me['parent'])),'w') for line in parentContent: - for substitution in me['substitutions']: - line = line.replace(substitution,me['substitutions'][substitution]) childFile.write(line.replace(me['versions'][0],version)) childFile.close()