summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-12-09 00:02:35 +0000
committerZac Medico <zmedico@gentoo.org>2006-12-09 00:02:35 +0000
commitf66720b6a5898f1b57ffa2ef3a0d04d98a5e4bdd (patch)
tree39c9dbc0012ecb4af659561d35ec25d7a4d304d6
parent125907972ada53e569ac7e86a4f7c9d2f9d771fa (diff)
downloadportage-f66720b6a5898f1b57ffa2ef3a0d04d98a5e4bdd.tar.gz
portage-f66720b6a5898f1b57ffa2ef3a0d04d98a5e4bdd.tar.bz2
portage-f66720b6a5898f1b57ffa2ef3a0d04d98a5e4bdd.zip
Clean up vardbapi.aux_get().
svn path=/main/trunk/; revision=5229
-rw-r--r--pym/portage.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 2bbc9dd54..e6dcc48bc 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -4791,24 +4791,24 @@ class vardbapi(dbapi):
return self.root+VDB_PATH+"/"+str(mycpv)+"/"+mycpv.split("/")[1]+".ebuild"
def aux_get(self, mycpv, wants):
- global auxdbkeys
+ mydir = os.path.join(self.root, VDB_PATH, mycpv)
+ if not os.path.isdir(mydir):
+ raise KeyError(mycpv)
results = []
for x in wants:
- myfn = self.root+VDB_PATH+"/"+str(mycpv)+"/"+str(x)
try:
- myf = open(myfn, "r")
- myd = myf.read()
- myf.close()
- myd = re.sub("[\n\r\t]+"," ",myd)
- myd = re.sub(" +"," ",myd)
- myd = string.strip(myd)
- except (IOError, OSError):
+ myf = open(os.path.join(mydir, x), "r")
+ try:
+ myd = myf.read()
+ finally:
+ myf.close()
+ myd = " ".join(myd.split())
+ except IOError:
myd = ""
- results.append(myd)
- if "EAPI" in wants:
- idx = wants.index("EAPI")
- if not results[idx]:
- results[idx] = "0"
+ if x == "EAPI" and not myd:
+ results.append("0")
+ else:
+ results.append(myd)
return results
def aux_update(self, cpv, values):