diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-08-04 06:45:46 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-08-04 06:45:46 +0000 |
commit | 729b7d573c13250ee981b6f957a47ce58e7bb2df (patch) | |
tree | 7a56d2521e352f6cc99de3dea6f1993ed7982dbe /pym/portage | |
parent | 1c6aec2925776edc6694c660877dd2b7a9ac7111 (diff) | |
download | portage-729b7d573c13250ee981b6f957a47ce58e7bb2df.tar.gz portage-729b7d573c13250ee981b6f957a47ce58e7bb2df.tar.bz2 portage-729b7d573c13250ee981b6f957a47ce58e7bb2df.zip |
Bug #280259 - Use codecs.open() when reading the Packages file inside
binarytree.inject(), in order to avoid a UnicodeDecodeError when the
file is later written as a unicode stream (via atomic_ofstream).
svn path=/main/trunk/; revision=13889
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/dbapi/bintree.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 41da32d39..2b4dd1834 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -21,6 +21,7 @@ from portage.localization import _ from portage import dep_expand, listdir, _check_distfile, _movefile +import codecs import os, errno, stat import re from itertools import chain, izip @@ -847,7 +848,8 @@ class binarytree(object): created_symlink = True pkgindex = self._new_pkgindex() try: - f = open(self._pkgindex_file) + f = codecs.open(self._pkgindex_file, + encoding='utf_8', errors='replace') except EnvironmentError: pass else: |