From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B5021138010 for ; Mon, 15 Oct 2012 17:17:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B871F21C003; Mon, 15 Oct 2012 17:17:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 2A0D221C003 for ; Mon, 15 Oct 2012 17:17:35 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 34D9B33D7A3 for ; Mon, 15 Oct 2012 17:17:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 86914E5436 for ; Mon, 15 Oct 2012 17:17:33 +0000 (UTC) From: "Arfrever Frehtes Taifersar Arahesis" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arfrever Frehtes Taifersar Arahesis" Message-ID: <1350321382.54e206ac6901b2f469638378e039d207f5024622.arfrever@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/resolver/output.py X-VCS-Directories: pym/_emerge/resolver/ X-VCS-Committer: arfrever X-VCS-Committer-Name: Arfrever Frehtes Taifersar Arahesis X-VCS-Revision: 54e206ac6901b2f469638378e039d207f5024622 X-VCS-Branch: master Date: Mon, 15 Oct 2012 17:17:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 2ea79ebb-baac-493d-8493-226b29f53c1d X-Archives-Hash: a65cdadeadcfe363e927b4337a738ff7 commit: 54e206ac6901b2f469638378e039d207f5024622 Author: Arfrever Frehtes Taifersar Arahesis Apache Org> AuthorDate: Mon Oct 15 17:16:22 2012 +0000 Commit: Arfrever Frehtes Taifersar Arahesis gmail com> CommitDate: Mon Oct 15 17:16:22 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=54e206ac Add Display._append_repository() to avoid duplication of some code. --- pym/_emerge/resolver/output.py | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) diff --git a/pym/_emerge/resolver/output.py b/pym/_emerge/resolver/output.py index 7035b55..130ba2d 100644 --- a/pym/_emerge/resolver/output.py +++ b/pym/_emerge/resolver/output.py @@ -419,6 +419,19 @@ class Display(object): pkg_str += "/" + pkg_info.sub_slot return pkg_str + def _append_repository(self, pkg_str, pkg, pkg_info): + """Potentially appends repository to package string. + + @param pkg_str: string + @param pkg: _emerge.Package.Package instance + @param pkg_info: dictionary + @rtype string + """ + if not self.quiet_repo_display and (self.verbose_main_repo_display or + any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg])): + pkg_str += _repo_separator + pkg.repo + return pkg_str + def _set_non_root_columns(self, pkg, pkg_info): """sets the indent level and formats the output @@ -429,9 +442,7 @@ class Display(object): ver_str = pkg_info.ver if self.conf.verbosity == 3: ver_str = self._append_slot(ver_str, pkg, pkg_info) - if not self.quiet_repo_display and (self.verbose_main_repo_display or - any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg])): - ver_str += _repo_separator + pkg.repo + ver_str = self._append_repository(ver_str, pkg, pkg_info) if self.conf.quiet: myprint = str(pkg_info.attr_display) + " " + self.indent + \ self.pkgprint(pkg_info.cp, pkg_info) @@ -470,9 +481,7 @@ class Display(object): ver_str = pkg_info.ver if self.conf.verbosity == 3: ver_str = self._append_slot(ver_str, pkg, pkg_info) - if not self.quiet_repo_display and (self.verbose_main_repo_display or - any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg])): - ver_str += _repo_separator + pkg.repo + ver_str = self._append_repository(ver_str, pkg, pkg_info) if self.conf.quiet: myprint = str(pkg_info.attr_display) + " " + self.indent + \ self.pkgprint(pkg_info.cp, pkg_info) @@ -509,9 +518,7 @@ class Display(object): pkg_str = pkg.cpv if self.conf.verbosity == 3: pkg_str = self._append_slot(pkg_str, pkg, pkg_info) - if not self.quiet_repo_display and (self.verbose_main_repo_display or - any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg])): - pkg_str += _repo_separator + pkg.repo + pkg_str = self._append_repository(pkg_str, pkg, pkg_info) if not pkg_info.merge: addl = self.empty_space_in_brackets() myprint = "[%s%s] %s%s %s" % \ @@ -802,7 +809,7 @@ class Display(object): # files to fetch list - avoids counting a same file twice # in size display (verbose mode) self.myfetchlist = set() - + self.quiet_repo_display = "--quiet-repo-display" in depgraph._frozen_config.myopts if self.quiet_repo_display: # Use this set to detect when all the "repoadd" strings are "[0]" @@ -866,9 +873,7 @@ class Display(object): pkg_str = pkg.cpv if self.conf.verbosity == 3: pkg_str = self._append_slot(pkg_str, pkg, pkg_info) - if not self.quiet_repo_display and (self.verbose_main_repo_display or - any(x.repo != self.portdb.repositories.mainRepo().name for x in pkg_info.oldbest_list + [pkg])): - pkg_str += _repo_separator + pkg.repo + pkg_str = self._append_repository(pkg_str, pkg, pkg_info) if not pkg_info.merge: addl = self.empty_space_in_brackets() myprint = "[%s%s] " % (