In dblink._unmerge_pkgfiles(), if the package appears to have been merged
authorZac Medico <zmedico@gentoo.org>
Fri, 14 Aug 2009 21:19:04 +0000 (21:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 14 Aug 2009 21:19:04 +0000 (21:19 -0000)
with a different value of sys.getfilesystemencoding(), fall back to utf_8
if appropriate.

svn path=/main/trunk/; revision=14049

pym/portage/dbapi/vartree.py

index d0a389ee5003637b1c88b7ad55c2fa6c2b70806f..10e48fc19e49b87a3506c5fef0d70171cbb7930f 100644 (file)
@@ -2376,6 +2376,20 @@ class dblink(object):
                                        scheduler.scheduleYield()
 
                                obj = normalize_path(objkey)
+                               if os is _os_merge:
+                                       try:
+                                               _unicode_encode(obj, encoding=_merge_encoding, 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='utf_8', errors='strict')
+                                               except UnicodeEncodeError:
+                                                       pass
+                                               else:
+                                                       os = portage.os
+
                                file_data = pkgfiles[objkey]
                                file_type = file_data[0]
                                statobj = None