1 |
Author: zmedico |
2 |
Date: 2009-08-04 06:45:46 +0000 (Tue, 04 Aug 2009) |
3 |
New Revision: 13889 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/dbapi/bintree.py |
7 |
Log: |
8 |
Bug #280259 - Use codecs.open() when reading the Packages file inside |
9 |
binarytree.inject(), in order to avoid a UnicodeDecodeError when the |
10 |
file is later written as a unicode stream (via atomic_ofstream). |
11 |
|
12 |
|
13 |
Modified: main/trunk/pym/portage/dbapi/bintree.py |
14 |
=================================================================== |
15 |
--- main/trunk/pym/portage/dbapi/bintree.py 2009-08-04 06:18:13 UTC (rev 13888) |
16 |
+++ main/trunk/pym/portage/dbapi/bintree.py 2009-08-04 06:45:46 UTC (rev 13889) |
17 |
@@ -21,6 +21,7 @@ |
18 |
|
19 |
from portage import dep_expand, listdir, _check_distfile, _movefile |
20 |
|
21 |
+import codecs |
22 |
import os, errno, stat |
23 |
import re |
24 |
from itertools import chain, izip |
25 |
@@ -847,7 +848,8 @@ |
26 |
created_symlink = True |
27 |
pkgindex = self._new_pkgindex() |
28 |
try: |
29 |
- f = open(self._pkgindex_file) |
30 |
+ f = codecs.open(self._pkgindex_file, |
31 |
+ encoding='utf_8', errors='replace') |
32 |
except EnvironmentError: |
33 |
pass |
34 |
else: |