1 |
commit: 6bfa7e9204b4af2ee0fc816c87ea2bffcce61ccb |
2 |
Author: dol-sen <brian.dolbec <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Jul 30 16:52:54 2011 +0000 |
4 |
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com> |
5 |
CommitDate: Sat Jul 30 16:52:54 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=6bfa7e92 |
7 |
|
8 |
add supported_types() to the api |
9 |
|
10 |
--- |
11 |
layman/api.py | 12 ++++++++++++ |
12 |
layman/overlays/source.py | 3 ++- |
13 |
2 files changed, 14 insertions(+), 1 deletions(-) |
14 |
|
15 |
diff --git a/layman/api.py b/layman/api.py |
16 |
index fefb6a0..869d882 100755 |
17 |
--- a/layman/api.py |
18 |
+++ b/layman/api.py |
19 |
@@ -22,6 +22,7 @@ from layman.config import BareConfig |
20 |
|
21 |
from layman.dbbase import UnknownOverlayException, UnknownOverlayMessage |
22 |
from layman.db import DB, RemoteDB |
23 |
+from layman.overlays.source import require_supported |
24 |
#from layman.utils import path, delete_empty_directory |
25 |
|
26 |
# give them some values for now, these are from the packagekit backend |
27 |
@@ -499,6 +500,17 @@ class LaymanAPI(object): |
28 |
return messages |
29 |
return [] |
30 |
|
31 |
+ def supported_types(self): |
32 |
+ """returns a dictionary of all repository types, |
33 |
+ with boolean values""" |
34 |
+ cmds = [x for x in self.config.keys() if '_command' in x] |
35 |
+ supported = {} |
36 |
+ for cmd in cmds: |
37 |
+ type_key = cmd.split('_')[0] |
38 |
+ supported[type_key] = require_supported( |
39 |
+ [(self.config[cmd],type_key, '')], self.output.warn) |
40 |
+ return supported |
41 |
+ |
42 |
|
43 |
def create_fd(): |
44 |
"""creates file descriptor pairs an opens them ready for |
45 |
|
46 |
diff --git a/layman/overlays/source.py b/layman/overlays/source.py |
47 |
index 083beb6..a62cd15 100644 |
48 |
--- a/layman/overlays/source.py |
49 |
+++ b/layman/overlays/source.py |
50 |
@@ -53,7 +53,8 @@ def require_supported(binaries, _output): |
51 |
for command, mtype, package in binaries: |
52 |
kind, path = _resolve_command(command, _output) |
53 |
if not path: |
54 |
- _output(kind + ' ' + command + ' seems to be missing!' |
55 |
+ if _output: |
56 |
+ _output(kind + ' ' + command + ' seems to be missing!' |
57 |
' Overlay type "' + mtype + '" not support' |
58 |
'ed. Did you emerge ' + package + '?', 6) |
59 |
return False |