Bug #280962 - Fix broken path normalization inside
authorZac Medico <zmedico@gentoo.org>
Mon, 10 Aug 2009 07:12:28 +0000 (07:12 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 10 Aug 2009 07:12:28 +0000 (07:12 -0000)
StaticFileSet.multiBuilder().

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

pym/portage/sets/files.py

index f0b6fed58310f1ed8089d108778f1b0bab6d9065..b5ad9a05dad9f5fb53dc76533c4d44653fd7d658 100644 (file)
@@ -126,17 +126,18 @@ class StaticFileSet(EditablePackageSet):
                        except KeyError:
                                raise SetConfigError(_("Could not find repository '%s'") % match.groupdict()["reponame"])
 
-               if isinstance(directory, unicode):
-                       # Avoid UnicodeDecodeError raised from
-                       # os.path.join when called by os.walk.
-                       directory_unicode = directory
-                       directory = directory.encode('utf_8', 'replace')
-               else:
-                       directory_unicode = unicode(directory,
-                               encoding='utf_8', errors='replace')
-
                if os.path.isdir(directory):
                        directory = normalize_path(directory)
+
+                       if isinstance(directory, unicode):
+                               # Avoid UnicodeDecodeError raised from
+                               # os.path.join when called by os.walk.
+                               directory_unicode = directory
+                               directory = directory.encode('utf_8', 'replace')
+                       else:
+                               directory_unicode = unicode(directory,
+                                       encoding='utf_8', errors='replace')
+
                        for parent, dirs, files in os.walk(directory):
                                if not isinstance(parent, unicode):
                                        parent = unicode(parent,