From 3f7885e36e14a3947de5895a511d36a7039a91ca Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 11 Jun 2012 15:37:30 -0700 Subject: [PATCH] QueryCommand: add get_db() classmethod --- pym/portage/package/ebuild/_ipc/QueryCommand.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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: -- 2.26.2