summaryrefslogtreecommitdiffstats
path: root/layman
diff options
context:
space:
mode:
authordol-sen <brian.dolbec@gmail.com>2011-07-30 09:52:54 -0700
committerdol-sen <brian.dolbec@gmail.com>2011-07-30 09:52:54 -0700
commit6bfa7e9204b4af2ee0fc816c87ea2bffcce61ccb (patch)
treee6fdd56d092c21c45ef18277e28a74533e135f39 /layman
parentba4481d37cbedc5700b5ea21c5a1897389ecc1cb (diff)
downloadlayman-6bfa7e9204b4af2ee0fc816c87ea2bffcce61ccb.tar.gz
layman-6bfa7e9204b4af2ee0fc816c87ea2bffcce61ccb.tar.bz2
layman-6bfa7e9204b4af2ee0fc816c87ea2bffcce61ccb.zip
add supported_types() to the api
Diffstat (limited to 'layman')
-rwxr-xr-xlayman/api.py12
-rw-r--r--layman/overlays/source.py3
2 files changed, 14 insertions, 1 deletions
diff --git a/layman/api.py b/layman/api.py
index fefb6a0..869d882 100755
--- a/layman/api.py
+++ b/layman/api.py
@@ -22,6 +22,7 @@ from layman.config import BareConfig
from layman.dbbase import UnknownOverlayException, UnknownOverlayMessage
from layman.db import DB, RemoteDB
+from layman.overlays.source import require_supported
#from layman.utils import path, delete_empty_directory
# give them some values for now, these are from the packagekit backend
@@ -499,6 +500,17 @@ class LaymanAPI(object):
return messages
return []
+ def supported_types(self):
+ """returns a dictionary of all repository types,
+ with boolean values"""
+ cmds = [x for x in self.config.keys() if '_command' in x]
+ supported = {}
+ for cmd in cmds:
+ type_key = cmd.split('_')[0]
+ supported[type_key] = require_supported(
+ [(self.config[cmd],type_key, '')], self.output.warn)
+ return supported
+
def create_fd():
"""creates file descriptor pairs an opens them ready for
diff --git a/layman/overlays/source.py b/layman/overlays/source.py
index 083beb6..a62cd15 100644
--- a/layman/overlays/source.py
+++ b/layman/overlays/source.py
@@ -53,7 +53,8 @@ def require_supported(binaries, _output):
for command, mtype, package in binaries:
kind, path = _resolve_command(command, _output)
if not path:
- _output(kind + ' ' + command + ' seems to be missing!'
+ if _output:
+ _output(kind + ' ' + command + ' seems to be missing!'
' Overlay type "' + mtype + '" not support'
'ed. Did you emerge ' + package + '?', 6)
return False