annotate pyikb/lconf.py @ 93:73f0a1cafc23

upgrade townHall first, then the wall.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 27 Oct 2008 11:06:11 +0800
parents 1c42ae140ad3
children
rev   line source
63
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
1 import os,string
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
2 class LoadConfigfile(object):
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
3 def __init__(self):
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
4 profile = os.environ["HOME"]+'/.eagleeye.pm'
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
5 self.cd={}
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
6 if os.path.isfile(profile):
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
7 print "Loading Config file."
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
8 cfile=open(profile,'r')
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
9 for line in cfile.xreadlines():
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
10 if line[0:3]=='$::':
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
11 con=string.split(line[3:-2])
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
12 self.cd[con[0]]=con[2][1:-1]
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
13 else:
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
14 print "File don't exist."
1c42ae140ad3 add Parser.py and lconf.py.
kevin@localhost.localdomain
parents:
diff changeset
15