summaryrefslogtreecommitdiffstats
path: root/pym/repoman
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-01-18 13:33:08 -0800
committerZac Medico <zmedico@gentoo.org>2013-01-18 13:36:47 -0800
commit71235479ab208318dff391420f9695f5cfaa9594 (patch)
treed36bc22802e3b13c8ca5dce4328540a287c6eb3f /pym/repoman
parent0d732def5d30b29ab2941f0c66919a3ec4e8eb02 (diff)
downloadportage-71235479ab208318dff391420f9695f5cfaa9594.tar.gz
portage-71235479ab208318dff391420f9695f5cfaa9594.tar.bz2
portage-71235479ab208318dff391420f9695f5cfaa9594.zip
Use unicode_literals more.
This helps to ensure consistent results, regardless of whether we're using Python 2 or Python 3.
Diffstat (limited to 'pym/repoman')
-rw-r--r--pym/repoman/checks.py4
-rw-r--r--pym/repoman/errors.py4
-rw-r--r--pym/repoman/herdbase.py6
-rw-r--r--pym/repoman/utilities.py24
4 files changed, 22 insertions, 16 deletions
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
index 36c98631b..83ce2ed6e 100644
--- a/pym/repoman/checks.py
+++ b/pym/repoman/checks.py
@@ -1,10 +1,12 @@
# repoman: Checks
-# Copyright 2007-2012 Gentoo Foundation
+# Copyright 2007-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
"""This module contains functions used in Repoman to ascertain the quality
and correctness of an ebuild."""
+from __future__ import unicode_literals
+
import codecs
from itertools import chain
import re
diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py
index c515502c4..51ffeb838 100644
--- a/pym/repoman/errors.py
+++ b/pym/repoman/errors.py
@@ -1,7 +1,9 @@
# repoman: Error Messages
-# Copyright 2007-2011 Gentoo Foundation
+# Copyright 2007-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+from __future__ import unicode_literals
+
COPYRIGHT_ERROR = 'Invalid Gentoo Copyright on line: %d'
LICENSE_ERROR = 'Invalid Gentoo/GPL License on line: %d'
CVS_HEADER_ERROR = 'Malformed CVS Header on line: %d'
diff --git a/pym/repoman/herdbase.py b/pym/repoman/herdbase.py
index 4c420d0ec..c5b88ff17 100644
--- a/pym/repoman/herdbase.py
+++ b/pym/repoman/herdbase.py
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
# repoman: Herd database analysis
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2 or later
+from __future__ import unicode_literals
+
import errno
import xml.etree.ElementTree
try:
@@ -63,7 +65,7 @@ def make_herd_base(filename):
parser=xml.etree.ElementTree.XMLParser(
target=_HerdsTreeBuilder()))
except ExpatError as e:
- raise ParseError("metadata.xml: " + str(e))
+ raise ParseError("metadata.xml: %s" % (e,))
except EnvironmentError as e:
func_call = "open('%s')" % filename
if e.errno == errno.EACCES:
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index b4080741d..8d24abb95 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -1,11 +1,11 @@
# repoman: Utilities
-# Copyright 2007-2012 Gentoo Foundation
+# Copyright 2007-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
"""This module contains utility functions to help repoman find ebuilds to
scan"""
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
__all__ = [
"detect_vcs_conflicts",
@@ -310,12 +310,12 @@ def format_qa_output(formatter, stats, fails, dofull, dofail, options, qawarning
# we only want key value pairs where value > 0
for category, number in \
filter(lambda myitem: myitem[1] > 0, iter(stats.items())):
- formatter.add_literal_data(_unicode_decode(" " + category.ljust(30)))
+ formatter.add_literal_data(" " + category.ljust(30))
if category in qawarnings:
formatter.push_style("WARN")
else:
formatter.push_style("BAD")
- formatter.add_literal_data(_unicode_decode(str(number)))
+ formatter.add_literal_data("%s" % number)
formatter.pop_style()
formatter.add_line_break()
if not dofull:
@@ -326,7 +326,7 @@ def format_qa_output(formatter, stats, fails, dofull, dofail, options, qawarning
if not full and len(fails_list) > 12:
fails_list = fails_list[:12]
for failure in fails_list:
- formatter.add_literal_data(_unicode_decode(" " + failure))
+ formatter.add_literal_data(" " + failure)
formatter.add_line_break()
@@ -775,7 +775,7 @@ def UpdateChangeLog(pkgdir, user, msg, skel_path, category, package,
line = line.replace('<PACKAGE_NAME>', package)
line = _update_copyright_year(year, line)
header_lines.append(line)
- header_lines.append(_unicode_decode('\n'))
+ header_lines.append('\n')
clskel_file.close()
# write new ChangeLog entry
@@ -785,10 +785,10 @@ def UpdateChangeLog(pkgdir, user, msg, skel_path, category, package,
if not fn.endswith('.ebuild'):
continue
ebuild = fn.split(os.sep)[-1][0:-7]
- clnew_lines.append(_unicode_decode('*%s (%s)\n' % (ebuild, date)))
+ clnew_lines.append('*%s (%s)\n' % (ebuild, date))
newebuild = True
if newebuild:
- clnew_lines.append(_unicode_decode('\n'))
+ clnew_lines.append('\n')
trivial_files = ('ChangeLog', 'Manifest')
display_new = ['+' + elem for elem in new
if elem not in trivial_files]
@@ -815,19 +815,19 @@ def UpdateChangeLog(pkgdir, user, msg, skel_path, category, package,
for line in textwrap.wrap(mesg, 80, \
initial_indent=' ', subsequent_indent=' ', \
break_on_hyphens=False):
- clnew_lines.append(_unicode_decode('%s\n' % line))
+ clnew_lines.append('%s\n' % line)
for line in textwrap.wrap(msg, 80, \
initial_indent=' ', subsequent_indent=' '):
- clnew_lines.append(_unicode_decode('%s\n' % line))
+ clnew_lines.append('%s\n' % line)
# Don't append a trailing newline if the file is new.
if clold_file is not None:
- clnew_lines.append(_unicode_decode('\n'))
+ clnew_lines.append('\n')
f = io.open(f, mode='w', encoding=_encodings['repo.content'],
errors='backslashreplace')
for line in clnew_lines:
- f.write(_unicode_decode(line))
+ f.write(line)
# append stuff from old ChangeLog
if clold_file is not None: