digestcheck: avoid display of u'' from KeyError
authorZac Medico <zmedico@gentoo.org>
Fri, 17 Dec 2010 21:08:16 +0000 (13:08 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 17 Dec 2010 21:16:43 +0000 (13:16 -0800)
In python-2.x, KeyError.__str__ produces unicode literals that we
don't want users to see.

pym/portage/package/ebuild/digestcheck.py

index c2c2beff362d2b2c383c55bf3de55f755ea49781..68ce1f5657ae80bcf51d2b0693c5c1b798a6ef76 100644 (file)
@@ -67,13 +67,12 @@ def digestcheck(myfiles, mysettings, strict=False, justmanifest=None):
                        eout.ebegin(_("checking %s ;-)") % f)
                        ftype = mf.findFile(f)
                        if ftype is None:
-                               raise KeyError(f)
+                               eout.eend(1)
+                               writemsg(_("\n!!! Missing digest for '%s'\n") % (f,),
+                                       noiselevel=-1)
+                               return 0
                        mf.checkFileHashes(ftype, f)
                        eout.eend(0)
-       except KeyError as e:
-               eout.eend(1)
-               writemsg(_("\n!!! Missing digest for %s\n") % str(e), noiselevel=-1)
-               return 0
        except FileNotFound as e:
                eout.eend(1)
                writemsg(_("\n!!! A file listed in the Manifest could not be found: %s\n") % str(e),