From: Zac Medico Date: Mon, 11 Jun 2012 22:37:30 +0000 (-0700) Subject: QueryCommand: add get_db() classmethod X-Git-Tag: v2.2.0_alpha111~56 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3f7885e36e14a3947de5895a511d36a7039a91ca;p=portage.git QueryCommand: add get_db() classmethod --- diff --git a/pym/portage/package/ebuild/_ipc/QueryCommand.py b/pym/portage/package/ebuild/_ipc/QueryCommand.py index 7bbb0e83b..d200fe80d 100644 --- a/pym/portage/package/ebuild/_ipc/QueryCommand.py +++ b/pym/portage/package/ebuild/_ipc/QueryCommand.py @@ -20,6 +20,12 @@ class QueryCommand(IpcCommand): _db = None + @classmethod + def get_db(cls): + if cls._db is not None: + return cls._db + return portage.db + def __init__(self, settings, phase): IpcCommand.__init__(self) self.settings = settings @@ -52,9 +58,7 @@ class QueryCommand(IpcCommand): use = frozenset(use.split()) atom = atom.evaluate_conditionals(use) - db = self._db - if db is None: - db = portage.db + db = self.get_db() warnings_str = '' if warnings: