From 7dbcf5e1752a77565b4c69cae444d441dfba0d5c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 13 May 2010 12:07:11 -0700 Subject: [PATCH] Use bytes literals in instead of _unicode_encode() where appropriate (works with python-2.6). Thanks to Arfrever for the suggestion. --- bin/repoman | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/repoman b/bin/repoman index 7b23aa37f..7a4eafb20 100755 --- a/bin/repoman +++ b/bin/repoman @@ -2342,13 +2342,10 @@ else: # When files are removed and re-added, the cvs server will put /Attic/ # inside the $Header path. This code detects the problem and corrects it # so that the Manifest will generate correctly. See bug #169500. - cvs_header = r'^#\s*\$Header.*\$$' - attic_str = "/Attic/" - attic_replace = "/" - cvs_header = _unicode_encode(cvs_header) - attic_str = _unicode_encode(attic_str) - attic_replace = _unicode_encode(attic_replace) - cvs_header_re = re.compile(cvs_header) + # Use binary mode in order to avoid potential character encoding issues. + cvs_header_re = re.compile(br'^#\s*\$Header.*\$$') + attic_str = b'/Attic/' + attic_replace = b'/' for x in myheaders: f = open(_unicode_encode(x, encoding=_encodings['fs'], errors='strict'), @@ -2362,7 +2359,7 @@ else: mylines[i] = line.replace(attic_str, attic_replace) modified = True if modified: - portage.util.write_atomic(x, _unicode_encode("").join(mylines), + portage.util.write_atomic(x, b''.join(mylines), mode='wb') manifest_commit_required = True -- 2.26.2