Mercurial > eagle-eye
annotate pyikriam/lconf.py @ 79:9d92e8c12f58
rewrited the code in XPath.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Fri, 24 Oct 2008 21:46:33 +0800 |
parents | 19d2a7b175b3 |
children | d4b7d8f51e9f |
rev | line source |
---|---|
64
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
1 import os,string |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
2 class LoadConfigfile(object): |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
3 def __init__(self): |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
4 profile = os.environ["HOME"]+'/.eagleeye.pm' |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
5 self.cd={} |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
6 if os.path.isfile(profile): |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
7 print "Loading Config file." |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
8 cfile=open(profile,'r') |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
9 for line in cfile.xreadlines(): |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
10 if line[0:3]=='$::': |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
11 con=string.split(line[3:-2]) |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
12 self.cd[con[0]]=con[2][1:-1] |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
13 else: |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
14 print "File don't exist." |
19d2a7b175b3
Load configure data from .eagleeye.pm
kevin@localhost.localdomain
parents:
diff
changeset
|
15 |