commit:     d63a4b1b586b4a1f5f6d841af582bb7fd1bcecff
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  4 17:56:41 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Feb  4 17:56:41 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d63a4b1b

man: get mkman.py working under py2 & py3

 man/mkman.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/man/mkman.py b/man/mkman.py
index cd0fa7a..1ec8584 100755
--- a/man/mkman.py
+++ b/man/mkman.py
@@ -1,4 +1,5 @@
 #!/usr/bin/python
+# -*- coding: utf-8 -*-
 
 """Generate man pages for the q applets"""
 
@@ -25,7 +26,7 @@ Q = os.path.join(TOPDIR, 'q')
 def FindApplets():
     """Return a list of all supported applets"""
     applets = os.path.join(TOPDIR, 'applets.sh')
-    return subprocess.check_output([applets]).splitlines()
+    return subprocess.check_output([applets]).decode('ascii').splitlines()
 
 
 COMMON_AUTHORS = [
@@ -61,7 +62,7 @@ def MkMan(applets, applet, output):
 
     # Extract the main use string and description:
     # Usage: q <applet> <args>  : invoke a portage utility applet
-    ahelp = subprocess.check_output([Q, applet, '--help'])
+    ahelp = subprocess.check_output([Q, applet, '--help']).decode('ascii')
     lines = ahelp.splitlines()
     m = re.search(r'^Usage: %s (.*) : (.*)' % applet, ahelp)
     usage = m.group(1)
@@ -77,7 +78,7 @@ def MkMan(applets, applet, output):
 
     # Extract all the options
     options = []
-    for line, i in zip(lines, xrange(len(lines))):
+    for line, i in zip(lines, range(len(lines))):
         if not line.startswith('Options: '):
             continue
 

Reply via email to