summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-06-30 08:18:51 +0000
committerZac Medico <zmedico@gentoo.org>2006-06-30 08:18:51 +0000
commitf4c2294623e713ce73fb84b90d601df56c7c0d2b (patch)
treed1ff87ec83bbf9efdb711a26fc5556abfd56a534
parent09fc7deef647933181da218c9825f81c135725fa (diff)
downloadportage-f4c2294623e713ce73fb84b90d601df56c7c0d2b.tar.gz
portage-f4c2294623e713ce73fb84b90d601df56c7c0d2b.tar.bz2
portage-f4c2294623e713ce73fb84b90d601df56c7c0d2b.zip
Allow the portagetree constructor to work without globals.
svn path=/main/trunk/; revision=3709
-rw-r--r--pym/portage.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 671612c91..a72d2a1f4 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -4054,18 +4054,23 @@ def match_from_list_original(mydep,mylist):
class portagetree:
- def __init__(self,root="/",virtual=None,clone=None):
- global portdb, settings
- self.settings = settings # for key_expand calls
+ def __init__(self, root="/", virtual=None, clone=None, settings=None,
+ portdb=None):
+
if clone:
self.root=clone.root
self.portroot=clone.portroot
self.pkglines=clone.pkglines
else:
self.root=root
+ if settings is None:
+ settings = globals()["settings"]
+ self.settings = settings
self.portroot=settings["PORTDIR"]
self.virtual=virtual
- self.dbapi=portdb
+ if portdb is None:
+ portdb = globals()["portdb"]
+ self.dbapi = portdb
def dep_bestmatch(self,mydep):
"compatibility method"