summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-20 22:08:22 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-20 22:08:22 +0000
commitd76337003072f96a2aada7b72715efbb80a3ca3b (patch)
tree7a6e07ee9d93230f877ee69003a0c70f057226c0 /pym/repoman
parentUse _unicode_encode() to ensure that only unicode strings are passed into (diff)
downloadportage-multirepo-d76337003072f96a2aada7b72715efbb80a3ca3b.tar.gz
portage-multirepo-d76337003072f96a2aada7b72715efbb80a3ca3b.tar.bz2
portage-multirepo-d76337003072f96a2aada7b72715efbb80a3ca3b.zip
Misc unicode fixes for repoman.
svn path=/main/trunk/; revision=14302
Diffstat (limited to 'pym/repoman')
-rw-r--r--pym/repoman/utilities.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
index fcabd599..3d8d43ae 100644
--- a/pym/repoman/utilities.py
+++ b/pym/repoman/utilities.py
@@ -33,6 +33,7 @@ from xml.dom import NotFoundErr
from xml.parsers.expat import ExpatError
from portage import os
from portage import _encodings
+from portage import _unicode_decode
from portage import _unicode_encode
from portage import output
from portage.output import red, green
@@ -221,12 +222,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 \
itertools.ifilter(lambda myitem: myitem[1] > 0, stats.iteritems()):
- formatter.add_literal_data(" " + category.ljust(30))
+ formatter.add_literal_data(_unicode_decode(" " + category.ljust(30)))
if category in qawarnings:
formatter.push_style("WARN")
else:
formatter.push_style("BAD")
- formatter.add_literal_data(str(number))
+ formatter.add_literal_data(_unicode_decode(str(number)))
formatter.pop_style()
formatter.add_line_break()
if not dofull:
@@ -237,7 +238,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(" " + failure)
+ formatter.add_literal_data(_unicode_decode(" " + failure))
formatter.add_line_break()
@@ -276,13 +277,17 @@ def get_commit_message_with_editor(editor, message=None):
from tempfile import mkstemp
fd, filename = mkstemp()
try:
- os.write(fd, "\n# Please enter the commit message " + \
+ os.write(fd, _unicode_encode(
+ "\n# Please enter the commit message " + \
"for your changes.\n# (Comment lines starting " + \
- "with '#' will not be included)\n")
+ "with '#' will not be included)\n",
+ encoding=_encodings['content'], errors='backslashreplace'))
if message:
- os.write(fd, "#\n")
+ os.write(fd, _unicode_encode("#\n",
+ encoding=_encodings['content'], errors='backslashreplace'))
for line in message:
- os.write(fd, "#" + line)
+ os.write(fd, _unicode_encode("#" + line,
+ encoding=_encodings['content'], errors='backslashreplace'))
os.close(fd)
retval = os.system(editor + " '%s'" % filename)
if not (os.WIFEXITED(retval) and os.WEXITSTATUS(retval) == os.EX_OK):