1 |
commit: 3f7885e36e14a3947de5895a511d36a7039a91ca |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jun 11 22:37:30 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jun 11 22:37:30 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=3f7885e3 |
7 |
|
8 |
QueryCommand: add get_db() classmethod |
9 |
|
10 |
--- |
11 |
pym/portage/package/ebuild/_ipc/QueryCommand.py | 10 +++++++--- |
12 |
1 files changed, 7 insertions(+), 3 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/package/ebuild/_ipc/QueryCommand.py b/pym/portage/package/ebuild/_ipc/QueryCommand.py |
15 |
index 7bbb0e8..d200fe8 100644 |
16 |
--- a/pym/portage/package/ebuild/_ipc/QueryCommand.py |
17 |
+++ b/pym/portage/package/ebuild/_ipc/QueryCommand.py |
18 |
@@ -20,6 +20,12 @@ class QueryCommand(IpcCommand): |
19 |
|
20 |
_db = None |
21 |
|
22 |
+ @classmethod |
23 |
+ def get_db(cls): |
24 |
+ if cls._db is not None: |
25 |
+ return cls._db |
26 |
+ return portage.db |
27 |
+ |
28 |
def __init__(self, settings, phase): |
29 |
IpcCommand.__init__(self) |
30 |
self.settings = settings |
31 |
@@ -52,9 +58,7 @@ class QueryCommand(IpcCommand): |
32 |
use = frozenset(use.split()) |
33 |
atom = atom.evaluate_conditionals(use) |
34 |
|
35 |
- db = self._db |
36 |
- if db is None: |
37 |
- db = portage.db |
38 |
+ db = self.get_db() |
39 |
|
40 |
warnings_str = '' |
41 |
if warnings: |