1 |
Author: zmedico |
2 |
Date: 2009-08-23 07:40:57 +0000 (Sun, 23 Aug 2009) |
3 |
New Revision: 14131 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/dbapi/vartree.py |
7 |
Log: |
8 |
Bug #282306 - Inside LinkageMap._ObjectKey._generate_object_key(), fall back |
9 |
to utf_8 encoding if a path cannot be encoded under the user's chosen |
10 |
encoding. This should complete the fix for the traceback shown in bug #282115, |
11 |
comment #6. |
12 |
|
13 |
|
14 |
Modified: main/trunk/pym/portage/dbapi/vartree.py |
15 |
=================================================================== |
16 |
--- main/trunk/pym/portage/dbapi/vartree.py 2009-08-23 07:25:40 UTC (rev 14130) |
17 |
+++ main/trunk/pym/portage/dbapi/vartree.py 2009-08-23 07:40:57 UTC (rev 14131) |
18 |
@@ -249,6 +249,21 @@ |
19 |
|
20 |
os = _os_merge |
21 |
|
22 |
+ try: |
23 |
+ _unicode_encode(obj, |
24 |
+ encoding=_encodings['merge'], errors='strict') |
25 |
+ except UnicodeEncodeError: |
26 |
+ # The package appears to have been merged with a |
27 |
+ # different value of sys.getfilesystemencoding(), |
28 |
+ # so fall back to utf_8 if appropriate. |
29 |
+ try: |
30 |
+ _unicode_encode(obj, |
31 |
+ encoding=_encodings['fs'], errors='strict') |
32 |
+ except UnicodeEncodeError: |
33 |
+ pass |
34 |
+ else: |
35 |
+ os = portage.os |
36 |
+ |
37 |
abs_path = os.path.join(root, obj.lstrip(os.sep)) |
38 |
try: |
39 |
object_stat = os.stat(abs_path) |