Bug #282269 - Avoid str() calls with overlay paths, which can trigger
authorZac Medico <zmedico@gentoo.org>
Sat, 22 Aug 2009 07:52:43 +0000 (07:52 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 22 Aug 2009 07:52:43 +0000 (07:52 -0000)
UnicodeEncodeError in python-2.x.

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

pym/_emerge/RepoDisplay.py
pym/_emerge/depgraph.py
pym/portage/dbapi/porttree.py

index a954aebfa9af64d13bb58b4c424be760e1fe712b..e98be93c40456a70ec49050f335fed876491e035 100644 (file)
@@ -48,6 +48,10 @@ class RepoDisplay(object):
                return s
 
        def __str__(self):
+               """
+               In python-2.x, str() can trigger a UnicodeEncodeError here,
+               so call __str__() directly.
+               """
                output = []
                shown_repos = self._shown_repos
                unknown_repo = self._unknown_repo
index ebb3bfda4e27ef141590e7ef04548efa3b7eba36..bd2964f3c46565b4aa370cb38ab824e355533c65 100644 (file)
@@ -4370,7 +4370,9 @@ class depgraph(object):
                        print
                        print counters
                        if show_repos:
-                               writemsg_stdout(str(repo_display), noiselevel=-1)
+                               # In python-2.x, str() can trigger a UnicodeEncodeError here,
+                               # so call __str__() directly.
+                               writemsg_stdout(repo_display.__str__(), noiselevel=-1)
 
                if "--changelog" in self._frozen_config.myopts:
                        writemsg_stdout('\n', noiselevel=-1)
index 34e9d178ef12d70f673694ec5eaac0e463ff5621..10baa4b9c7f94667f3f61bb77e57a7f9b6b2c1ae 100644 (file)
@@ -604,15 +604,11 @@ class portdbapi(dbapi):
                mydata, st, emtime = self._pull_valid_cache(mycpv, myebuild, mylocation)
                doregen = mydata is None
 
-               writemsg(_("auxdb is valid: ")+str(not doregen)+" "+str(pkg)+"\n", 2)
-
                if doregen:
                        if myebuild in self._broken_ebuilds:
                                raise KeyError(mycpv)
                        if not self._have_root_eclass_dir:
                                raise KeyError(mycpv)
-                       writemsg("doregen: %s %s\n" % (doregen, mycpv), 2)
-                       writemsg(_("Generating cache entry(0) for: ")+str(myebuild)+"\n", 1)
 
                        self.doebuild_settings.setcpv(mycpv)
                        mydata = {}
@@ -831,7 +827,7 @@ class portdbapi(dbapi):
                                                os.path.join(self.mysettings["DISTDIR"], x), mysums[x])
                                except FileNotFound, e:
                                        ok = False
-                                       reason = _("File Not Found: '%s'") % str(e)
+                                       reason = _("File Not Found: '%s'") % (e,)
                        if not ok:
                                failures[x] = reason
                if failures:
@@ -1105,7 +1101,7 @@ class portdbapi(dbapi):
                        except PortageException, e:
                                writemsg("!!! Error: aux_get('%s', %s)\n" % (mycpv, aux_keys),
                                        noiselevel=-1)
-                               writemsg("!!! %s\n" % str(e), noiselevel=-1)
+                               writemsg("!!! %s\n" % (e,), noiselevel=-1)
                                del e
                                continue
                        eapi = metadata["EAPI"]