diff options
author | Sebastian Luther <SebastianLuther@gmx.de> | 2010-09-20 12:50:23 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-20 08:11:38 -0700 |
commit | e1832018e84a75871c69e1d1c7779592014fa041 (patch) | |
tree | bd52f7ae4fd3d02c66d84ba57bce1fcf37c37dde /pym/_emerge/RepoDisplay.py | |
parent | 7f089f0d6b25d539d1ff16abc6bcc930a613e22a (diff) | |
download | portage-e1832018e84a75871c69e1d1c7779592014fa041.tar.gz portage-e1832018e84a75871c69e1d1c7779592014fa041.tar.bz2 portage-e1832018e84a75871c69e1d1c7779592014fa041.zip |
Move mergelist printing into resolver/output.py
Diffstat (limited to 'pym/_emerge/RepoDisplay.py')
-rw-r--r-- | pym/_emerge/RepoDisplay.py | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/pym/_emerge/RepoDisplay.py b/pym/_emerge/RepoDisplay.py deleted file mode 100644 index 5a66b5b9c..000000000 --- a/pym/_emerge/RepoDisplay.py +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -import sys - -from portage.output import teal -from portage import os -from portage import _encodings, _unicode_encode - -class RepoDisplay(object): - def __init__(self, roots): - self._shown_repos = {} - self._unknown_repo = False - repo_paths = set() - for root_config in roots.values(): - portdir = root_config.settings.get("PORTDIR") - if portdir: - repo_paths.add(portdir) - overlays = root_config.settings.get("PORTDIR_OVERLAY") - if overlays: - repo_paths.update(overlays.split()) - repo_paths = list(repo_paths) - self._repo_paths = repo_paths - self._repo_paths_real = [ os.path.realpath(repo_path) \ - for repo_path in repo_paths ] - - # pre-allocate index for PORTDIR so that it always has index 0. - for root_config in roots.values(): - portdb = root_config.trees["porttree"].dbapi - portdir = portdb.porttree_root - if portdir: - self.repoStr(portdir) - - def repoStr(self, repo_path_real): - real_index = -1 - if repo_path_real: - real_index = self._repo_paths_real.index(repo_path_real) - if real_index == -1: - s = "?" - self._unknown_repo = True - else: - shown_repos = self._shown_repos - repo_paths = self._repo_paths - repo_path = repo_paths[real_index] - index = shown_repos.get(repo_path) - if index is None: - index = len(shown_repos) - shown_repos[repo_path] = index - s = str(index) - return s - - def __str__(self): - """ - In python-2.x, str() can trigger a UnicodeEncodeError here, - so call __str__() directly. - """ - output = [] - shown_repos = self._shown_repos - unknown_repo = self._unknown_repo - if shown_repos or self._unknown_repo: - output.append("Portage tree and overlays:\n") - show_repo_paths = list(shown_repos) - for repo_path, repo_index in shown_repos.items(): - show_repo_paths[repo_index] = repo_path - if show_repo_paths: - for index, repo_path in enumerate(show_repo_paths): - output.append(" "+teal("["+str(index)+"]")+" %s\n" % repo_path) - if unknown_repo: - output.append(" "+teal("[?]") + \ - " indicates that the source repository could not be determined\n") - return "".join(output) - - if sys.hexversion < 0x3000000: - - __unicode__ = __str__ - - def __str__(self): - return _unicode_encode(self.__unicode__(), - encoding=_encodings['content']) |