Bug #295805 - Fix ValueError with python3 inside update_config_files().
authorZac Medico <zmedico@gentoo.org>
Sun, 6 Dec 2009 11:00:46 +0000 (11:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 6 Dec 2009 11:00:46 +0000 (11:00 -0000)
(trunk r14929)

svn path=/main/branches/2.1.7/; revision=14943

pym/portage/update.py

index 04812d5a466788987c28d352264f73e3349f3dc8..af0fd2f42cee4bb5b59a50b7b4d2098a7b2c8fd0 100644 (file)
@@ -201,15 +201,20 @@ def update_config_files(config_root, protect, protect_mask, update_iter):
                config_file = os.path.join(abs_user_config, x)
                if os.path.isdir(config_file):
                        for parent, dirs, files in os.walk(config_file):
-                               for y in dirs:
+                               try:
+                                       parent = _unicode_decode(parent,
+                                               encoding=_encodings['fs'], errors='strict')
+                               except UnicodeDecodeError:
+                                       continue
+                               for y_enc in dirs:
                                        try:
-                                               y = _unicode_decode(y,
+                                               y = _unicode_decode(y_enc,
                                                        encoding=_encodings['fs'], errors='strict')
                                        except UnicodeDecodeError:
-                                               dirs.remove(y)
+                                               dirs.remove(y_enc)
                                                continue
                                        if y.startswith("."):
-                                               dirs.remove(y)
+                                               dirs.remove(y_enc)
                                for y in files:
                                        try:
                                                y = _unicode_decode(y,