public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/eshowkw/
Date: Mon, 16 May 2011 16:40:57 +0000 (UTC)	[thread overview]
Message-ID: <f5def123a156abc90841da2ade2601f06623010d.dol-sen@gentoo> (raw)

commit:     f5def123a156abc90841da2ade2601f06623010d
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon May 16 16:38:02 2011 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon May 16 16:38:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=f5def123

fix py3 compatibility issues in eshowkw.

---
 pym/gentoolkit/eshowkw/__init__.py         |   12 +++++++-----
 pym/gentoolkit/eshowkw/display_pretty.py   |    9 ++++++---
 pym/gentoolkit/eshowkw/keywords_content.py |    6 +++---
 pym/gentoolkit/eshowkw/keywords_header.py  |    4 ++--
 4 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/pym/gentoolkit/eshowkw/__init__.py b/pym/gentoolkit/eshowkw/__init__.py
index 9c70bee..e0544a9 100644
--- a/pym/gentoolkit/eshowkw/__init__.py
+++ b/pym/gentoolkit/eshowkw/__init__.py
@@ -14,10 +14,10 @@ from portage import config as portc
 from portage import portdbapi as portdbapi
 from portage import db as portdb
 
-from .keywords_header import keywords_header
-from .keywords_content import keywords_content
-from .display_pretty import string_rotator
-from .display_pretty import display
+from gentoolkit.eshowkw.keywords_header import keywords_header
+from gentoolkit.eshowkw.keywords_content import keywords_content
+from gentoolkit.eshowkw.display_pretty import string_rotator
+from gentoolkit.eshowkw.display_pretty import display
 
 ignore_slots = False
 bold = False
@@ -25,6 +25,7 @@ order = 'bottom'
 topper = 'versionlist'
 
 def process_display(package, keywords, dbapi):
+
 	portdata = keywords_content(package, keywords.keywords, dbapi, ignore_slots, order, bold, topper)
 	if topper == 'archlist':
 		header = string_rotator().rotateContent(keywords.content, keywords.length, bold)
@@ -108,7 +109,8 @@ def main(argv, indirect = False):
 		dbapi = portdbapi(mysettings=mysettings)
 		if not use_overlays:
 			dbapi.porttrees = [dbapi.porttree_root]
-		map(lambda x: process_display(x, keywords, dbapi), package)
+		for pkg in package:
+			process_display(pkg, keywords, dbapi)
 	else:
 		currdir = os.getcwd()
 		# check if there are actualy some ebuilds

diff --git a/pym/gentoolkit/eshowkw/display_pretty.py b/pym/gentoolkit/eshowkw/display_pretty.py
index 270a0eb..beca5f4 100644
--- a/pym/gentoolkit/eshowkw/display_pretty.py
+++ b/pym/gentoolkit/eshowkw/display_pretty.py
@@ -3,7 +3,10 @@
 # Distributed under the terms of the GNU General Public License v2
 
 from portage.output import colorize
-from itertools import izip_longest
+try: # newer python versions
+	from itertools import zip_longest
+except ImportError: # older python naming
+	from itertools import izip_longest as zip_longest
 
 __all__ = ['string_rotator', 'colorize_string', 'align_string', 'rotate_dash', 'print_content', 'display']
 
@@ -17,14 +20,14 @@ def display(plain_list, rotated_list, plain_width, rotated_height, cp, toplist =
 	if toplist != 'archlist':
 		corner_image.extend(plain_list)
 	data_printout = ['%s%s' % (x, y)
-		for x, y in izip_longest(corner_image, rotated_list, fillvalue=corner_image[0])]
+		for x, y in zip_longest(corner_image, rotated_list, fillvalue=corner_image[0])]
 	if toplist == 'archlist':
 		data_printout.extend(plain_list)
 	output.extend(data_printout)
 	print(print_content(output))
 
 def align_string(string, align, length):
-	"""Align string to the specified alignment (left or right, and after rotation it becames top and bottom)"""
+	"""Align string to the specified alignment (left or right, and after rotation it becomes top and bottom)"""
 	if align == 'top' or align == 'left':
 		string = string.ljust(length)
 	else:

diff --git a/pym/gentoolkit/eshowkw/keywords_content.py b/pym/gentoolkit/eshowkw/keywords_content.py
index 637c99a..99d652e 100644
--- a/pym/gentoolkit/eshowkw/keywords_content.py
+++ b/pym/gentoolkit/eshowkw/keywords_content.py
@@ -8,8 +8,8 @@ from portage.output import colorize
 
 __all__ = ['keywords_content']
 
-from display_pretty import colorize_string
-from display_pretty import align_string
+from gentoolkit.eshowkw.display_pretty import colorize_string
+from gentoolkit.eshowkw.display_pretty import align_string
 
 class keywords_content:
 	class RedundancyChecker:
@@ -101,7 +101,7 @@ class keywords_content:
 		def __getVersions(self, packages):
 			"""Obtain properly aligned version strings without colors."""
 			revlength = max([len(self.__getRevision(x)) for x in packages])
-			return map(lambda x: self.__separateVersion(x, revlength), packages)
+			return  [self.__separateVersion(x, revlength) for x in packages]
 
 		def __getRevision(self, cpv):
 			"""Get revision informations for each package for nice further alignment"""

diff --git a/pym/gentoolkit/eshowkw/keywords_header.py b/pym/gentoolkit/eshowkw/keywords_header.py
index 23588a4..f7e3e50 100644
--- a/pym/gentoolkit/eshowkw/keywords_header.py
+++ b/pym/gentoolkit/eshowkw/keywords_header.py
@@ -6,8 +6,8 @@ __all__ = ['keywords_header']
 
 from portage import settings as ports
 from portage.output import colorize
-from display_pretty import colorize_string
-from display_pretty import align_string
+from gentoolkit.eshowkw.display_pretty import colorize_string
+from gentoolkit.eshowkw.display_pretty import align_string
 
 class keywords_header:
 	__IMPARCHS = [ 'arm', 'amd64', 'x86' ]



             reply	other threads:[~2011-05-16 16:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16 16:40 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-08-09 20:14 [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/eshowkw/ Michał Górny
2012-05-16 21:59 Paul Varner
2012-05-08 21:06 Paul Varner
2012-04-11 15:01 Paul Varner
2011-05-29 10:59 Christian Ruppert
2011-02-25  2:23 Brian Dolbec
2011-02-25  2:23 Brian Dolbec
2011-02-24 21:49 Christian Ruppert
2011-02-24 21:41 Christian Ruppert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f5def123a156abc90841da2ade2601f06623010d.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox