From f4c2294623e713ce73fb84b90d601df56c7c0d2b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 30 Jun 2006 08:18:51 +0000 Subject: [PATCH] Allow the portagetree constructor to work without globals. svn path=/main/trunk/; revision=3709 --- pym/portage.py | 13 +++++++++---- 1 file 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" -- 2.26.2