now aware of blank and comment lines in pathinfo

This commit is contained in:
Philip Eisenlohr 2011-12-20 10:55:47 +00:00
parent 7dff3ba12c
commit 8be14ef72e
1 changed files with 6 additions and 9 deletions

View File

@ -7,12 +7,8 @@ class Environment():
] ]
def __init__(self,rootRelation = '.'): def __init__(self,rootRelation = '.'):
self.pathInfo = {\
'acml': '/opt/acml4.4.0',
'fftw': '.',
'msc': '/msc',
}
self.rootRelation = rootRelation self.rootRelation = rootRelation
self.pathInfo = {}
self.get_pathInfo() self.get_pathInfo()
def relPath(self,relative = '.'): def relPath(self,relative = '.'):
@ -38,12 +34,13 @@ class Environment():
def get_pathInfo(self): def get_pathInfo(self):
try: # check for user-defined pathinfo try: # check for user-defined pathinfo
file = open(self.relPath('lib/pathinfo')) file = open(self.relPath('lib/pathinfo'))
content = file.readlines() content = map(lambda string: string.strip(),file.readlines())
file.close() file.close()
for line in content: for line in content:
items = line.split() + ['',''] if not (line.startswith('#') or line == ''):
self.pathInfo[items[0].lower()] = {False: os.path.normpath(os.path.join(self.relPath('lib/'),items[1])), items = line.split() + ['','']
True: items[1]}[items[1] == ''] self.pathInfo[items[0].lower()] = {False: os.path.normpath(os.path.join(self.relPath('lib/'),items[1])),
True: items[1]}[items[1] == '']
except: except:
pass pass