From: Zac Medico Date: Fri, 30 Jun 2006 08:18:51 +0000 (-0000) Subject: Allow the portagetree constructor to work without globals. X-Git-Tag: v2.1.1~334 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f4c2294623e713ce73fb84b90d601df56c7c0d2b;p=portage.git Allow the portagetree constructor to work without globals. svn path=/main/trunk/; revision=3709 --- 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"