aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <brian.dolbec@gmail.com>2011-01-17 20:05:48 -0800
committerBrian Dolbec <brian.dolbec@gmail.com>2011-02-12 19:48:34 -0800
commit92298c7aa198f0492655d365fd8bb11f2d883869 (patch)
tree30a5cbfcfb420bb47265ae29309eefe9469bcd3a
parentadd a few more files to ignore (diff)
downloadlayman-92298c7aa198f0492655d365fd8bb11f2d883869.tar.gz
layman-92298c7aa198f0492655d365fd8bb11f2d883869.tar.bz2
layman-92298c7aa198f0492655d365fd8bb11f2d883869.zip
add a generator for source types the same as source uris.
use the generator in get_all_info(). pylint cleanup.
-rw-r--r--layman/api.py23
-rw-r--r--layman/overlays/overlay.py5
2 files changed, 17 insertions, 11 deletions
diff --git a/layman/api.py b/layman/api.py
index dfce4a0..99696f8 100644
--- a/layman/api.py
+++ b/layman/api.py
@@ -13,8 +13,8 @@
# Brian Dolbec <dol-sen@sourceforge.net>
#
-from sys import stderr, stdin, stdout
-import os, types
+from sys import stderr
+import os
from layman.config import BareConfig
#from layman.action import Sync
@@ -22,7 +22,7 @@ from layman.config import BareConfig
from layman.dbbase import UnknownOverlayException
from layman.db import DB, RemoteDB
#from layman.utils import path, delete_empty_directory
-from layman.debug import Message, OUT
+from layman.debug import OUT
# give them some values for now, these are from the packagekit backend
# TODO establish some proper errors for the api.
@@ -215,7 +215,8 @@ class LaymanAPI(object):
'description': overlay.description,
#'src_uris': [e.src for e in overlay.sources],
'src_uris': overlay.source_uris(),
- 'src_types': [e.type for e in overlay.sources],
+ 'src_types': overlay.source_types(),
+ #'src_types': [e.type for e in overlay.sources],
'priority': overlay.priority,
'quality': overlay.quality,
'status': overlay.status,
@@ -308,7 +309,7 @@ class LaymanAPI(object):
ordb = self._get_remote_db().select(ovl)
except UnknownOverlayException:
message = 'Overlay "%s" could not be found in the remote lists.\n' \
- 'Please check if it has been renamed and re-add if necessary.' %ovl
+ 'Please check if it has been renamed and re-add if necessary.' % ovl
warnings.append((ovl, message))
else:
current_src = odb.sources[0].src
@@ -420,10 +421,10 @@ class LaymanAPI(object):
defaults to stderr. This method may be removed, is here for now
due to code taken from the packagekit backend.
"""
- m = "Error: %d," %num, message
- self._error_messages.append(m)
+ msg = "Error: %d," % num, message
+ self._error_messages.append(msg)
if self.report_errors:
- print >>stderr, m
+ print >>stderr, msg
def get_errors(self):
@@ -445,8 +446,8 @@ def create_fd():
use in place of stdin, stdout, stderr.
"""
fd_r, fd_w = os.pipe()
- w = os.fdopen(fd_w, 'w')
- r = os.fdopen(fd_r, 'r')
- return (r, w, fd_r, fd_w)
+ write = os.fdopen(fd_w, 'w')
+ rread = os.fdopen(fd_r, 'r')
+ return (read, write, fd_r, fd_w)
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 9e41fe9..c7c9cce 100644
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -403,6 +403,11 @@ class Overlay(object):
for i in self.sources:
yield i.src
+ def source_types(self):
+ for i in self.sources:
+ yield i.type
+
+
#================================================================================
#
# Testing