summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-05-13 12:07:11 -0700
committerZac Medico <zmedico@gentoo.org>2010-05-13 12:07:11 -0700
commit7dbcf5e1752a77565b4c69cae444d441dfba0d5c (patch)
treefe01f48cc81beb991b8318e4f4de157bbf506129
parentBug 270108 - Trigger ebuild.invalidname if a version contains more than (diff)
downloadportage-idfetch-7dbcf5e1752a77565b4c69cae444d441dfba0d5c.tar.gz
portage-idfetch-7dbcf5e1752a77565b4c69cae444d441dfba0d5c.tar.bz2
portage-idfetch-7dbcf5e1752a77565b4c69cae444d441dfba0d5c.zip
Use bytes literals in instead of _unicode_encode() where appropriate
(works with python-2.6). Thanks to Arfrever for the suggestion.
-rwxr-xr-xbin/repoman13
1 files changed, 5 insertions, 8 deletions
diff --git a/bin/repoman b/bin/repoman
index 7b23aa37..7a4eafb2 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