diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-06-30 10:10:06 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-06-30 10:10:06 +0000 |
commit | b74bf9d6ad8ef6e743efa78a1d97699d91e3f68e (patch) | |
tree | f019a32f8a17c2eb898dcb01d93a61d80b092ed1 | |
parent | be32dc342b03178f95c18da414dc1678220ba2f4 (diff) | |
download | portage-b74bf9d6ad8ef6e743efa78a1d97699d91e3f68e.tar.gz portage-b74bf9d6ad8ef6e743efa78a1d97699d91e3f68e.tar.bz2 portage-b74bf9d6ad8ef6e743efa78a1d97699d91e3f68e.zip |
Pass a config instance into the bindbapi and fakedbapi constructors in order to avoid dependance on globals for dep_expand() calls.
svn path=/main/trunk/; revision=3716
-rwxr-xr-x | bin/emerge | 4 | ||||
-rw-r--r-- | pym/portage.py | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/bin/emerge b/bin/emerge index fc11cfb97..6bde09bc1 100755 --- a/bin/emerge +++ b/bin/emerge @@ -618,12 +618,12 @@ class depgraph: self.orderedkeys=[] self.outdatedpackages=[] self.mydbapi={} - self.mydbapi["/"] = portage.fakedbapi() + self.mydbapi["/"] = portage.fakedbapi(settings=settings) if "empty" not in self.myparams or settings["ROOT"] != "/": for pkg in self.trees["/"]["vartree"].getallcpv(): self.mydbapi["/"].cpv_inject(pkg) if settings["ROOT"] != "/": - self.mydbapi[settings["ROOT"]] = portage.fakedbapi() + self.mydbapi[settings["ROOT"]] = portage.fakedbapi(settings=settings) if "empty" not in self.myparams: for pkg in self.trees[settings["ROOT"]]["vartree"].getallcpv(): self.mydbapi[settings["ROOT"]].cpv_inject(pkg) diff --git a/pym/portage.py b/pym/portage.py index e7bb750bb..f82045fcf 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -4143,7 +4143,7 @@ class dbapi: raise NotImplementedError def match(self,origdep,use_cache=1): - mydep=dep_expand(origdep,mydb=self) + mydep = dep_expand(origdep, mydb=self, settings=self.settings) mykey=dep_getkey(mydep) mycat=mykey.split("/")[0] return match_from_list(mydep,self.cp_list(mykey,use_cache=use_cache)) @@ -4170,9 +4170,12 @@ class dbapi: class fakedbapi(dbapi): "This is a dbapi to use for the emptytree function. It's empty, but things can be added to it." - def __init__(self): + def __init__(self, settings=None): self.cpvdict={} self.cpdict={} + if settings is None: + settings = globals()["settings"] + self.settings = settings def cpv_exists(self,mycpv): return self.cpvdict.has_key(mycpv) @@ -4221,10 +4224,13 @@ class fakedbapi(dbapi): del self.cpdict[mycp] class bindbapi(fakedbapi): - def __init__(self,mybintree=None): + def __init__(self, mybintree=None, settings=None): self.bintree = mybintree self.cpvdict={} self.cpdict={} + if settings is None: + settings = globals()["settings"] + self.settings = settings def match(self, *pargs, **kwargs): if self.bintree and not self.bintree.populated: @@ -5444,7 +5450,7 @@ class binarytree(packagetree): self.root=root #self.pkgdir=settings["PKGDIR"] self.pkgdir=pkgdir - self.dbapi=bindbapi(self) + self.dbapi = bindbapi(self, settings=settings) self.populated=0 self.tree={} self.remotepkgs={} |