From 8be14ef72e4eb9e4fd73f5378698f9976a12a61b Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Tue, 20 Dec 2011 10:55:47 +0000 Subject: [PATCH] now aware of blank and comment lines in pathinfo --- lib/damask/environment.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/damask/environment.py b/lib/damask/environment.py index 34643c199..b53b86f28 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -7,12 +7,8 @@ class Environment(): ] def __init__(self,rootRelation = '.'): - self.pathInfo = {\ - 'acml': '/opt/acml4.4.0', - 'fftw': '.', - 'msc': '/msc', - } self.rootRelation = rootRelation + self.pathInfo = {} self.get_pathInfo() def relPath(self,relative = '.'): @@ -38,12 +34,13 @@ class Environment(): def get_pathInfo(self): try: # check for user-defined pathinfo file = open(self.relPath('lib/pathinfo')) - content = file.readlines() + content = map(lambda string: string.strip(),file.readlines()) file.close() for line in content: - items = line.split() + ['',''] - self.pathInfo[items[0].lower()] = {False: os.path.normpath(os.path.join(self.relPath('lib/'),items[1])), - True: items[1]}[items[1] == ''] + if not (line.startswith('#') or line == ''): + items = line.split() + ['',''] + self.pathInfo[items[0].lower()] = {False: os.path.normpath(os.path.join(self.relPath('lib/'),items[1])), + True: items[1]}[items[1] == ''] except: pass