aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordol-sen <brian.dolbec@gmail.com>2011-05-16 09:38:02 -0700
committerdol-sen <brian.dolbec@gmail.com>2011-05-16 09:38:02 -0700
commitf5def123a156abc90841da2ade2601f06623010d (patch)
tree4008e2deedd03eccbb953ad672e8141db0af79b9 /pym/gentoolkit/eshowkw
parentUpdate setup.py for namespace change of analyse to enalyze (diff)
downloadgentoolkit-f5def123a156abc90841da2ade2601f06623010d.tar.gz
gentoolkit-f5def123a156abc90841da2ade2601f06623010d.tar.bz2
gentoolkit-f5def123a156abc90841da2ade2601f06623010d.zip
fix py3 compatibility issues in eshowkw.
Diffstat (limited to 'pym/gentoolkit/eshowkw')
-rw-r--r--pym/gentoolkit/eshowkw/__init__.py12
-rw-r--r--pym/gentoolkit/eshowkw/display_pretty.py9
-rw-r--r--pym/gentoolkit/eshowkw/keywords_content.py6
-rw-r--r--pym/gentoolkit/eshowkw/keywords_header.py4
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' ]