diff options
author | 2011-01-17 20:05:48 -0800 | |
---|---|---|
committer | 2011-01-17 20:05:48 -0800 | |
commit | 87eadf30ff0cca2a2196d3bb95f44e58f2d404aa (patch) | |
tree | 8838ecd4b1231f51c50140de2c67658a9524dc29 | |
parent | fix missing import (diff) | |
download | overlord-87eadf30ff0cca2a2196d3bb95f44e58f2d404aa.tar.gz overlord-87eadf30ff0cca2a2196d3bb95f44e58f2d404aa.tar.bz2 overlord-87eadf30ff0cca2a2196d3bb95f44e58f2d404aa.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.py | 23 | ||||
-rw-r--r-- | layman/overlays/overlay.py | 5 |
2 files changed, 17 insertions, 11 deletions
diff --git a/layman/api.py b/layman/api.py index e722087..8b19295 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, @@ -307,7 +308,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 @@ -419,10 +420,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): @@ -443,8 +444,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 |