From a458572858e857606139fcebe74f1701fff8eba3 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 24 Aug 2009 09:44:30 +0000 Subject: [PATCH] Merged from trunk -r14130:14131 | 14131 | Bug #282306 - Inside | | zmedico | LinkageMap._ObjectKey._generate_object_key(), fall back to | | | utf_8 encoding if a path cannot be encoded under the user's | | | chosen encoding. This should complete the fix for the | | | traceback shown in bug #282115, comment #6. | svn path=/main/branches/prefix/; revision=14146 --- pym/portage/dbapi/vartree.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index a11cb39d2..9188970b4 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -250,6 +250,21 @@ class LinkageMap(object): os = _os_merge + try: + _unicode_encode(obj, + encoding=_encodings['merge'], errors='strict') + except UnicodeEncodeError: + # The package appears to have been merged with a + # different value of sys.getfilesystemencoding(), + # so fall back to utf_8 if appropriate. + try: + _unicode_encode(obj, + encoding=_encodings['fs'], errors='strict') + except UnicodeEncodeError: + pass + else: + os = portage.os + abs_path = os.path.join(root, obj.lstrip(os.sep)) try: object_stat = os.stat(abs_path) -- 2.26.2