Summary: | app-portage/layman-1.2.3: error when invoking layman with "-Lv" | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | makism <makism> |
Component: | Current packages | Assignee: | Sebastian Pipping <sping> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | beolach+gb |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Patch for http://www.gentoo.org/proj/en/overlays/layman-global.txt |
Description
makism
2009-09-24 19:49:53 UTC
I also encountered this. I think the best fix for now is to fix layman's remote/global list of overlays w/ the attached patch. Long rambling description below. I found that it was being caused by the description for the multimedia overlay using Unicode U+2019 "RIGHT SINGLE QUOTATION MARK" for the apostrophe in "gentoo’s", which apparently str() in python-2.6 can't handle. Editing /usr/lib64/python2.6/site-packages/layman/overlay.py & changing str(overlay) to unicode(overlay) gets it past the traceback makism posted, and it looks like it mostly works, except for a few funky issues I don't understand. Just running "layman -vL" works fine, printing out all the info for all the overlays, including those after multimedia, but the Unicode U+2019 "RIGHT SINGLE QUOTATION MARK" somehow becomes Unicode U+00e2 "LATIN SMALL LETTER A WITH CIRCUMFLEX" - "gentoo’s" becomes "gentooâs". Which is weird, but I could live with that. But what's even weirder is that if stdout is redirected, as with "layman -vL | cat", it prints everything through the first line of multimedia's description, but when it hits the line w/ the Unicode character it dies like this: * multimedia * ~~~~~~~~~~ * Source : git://gitorious.org/gentoo-multimedia/gentoo-multimedia.git * Contact : media-video@gentoo.org * Type : Git; Priority: 50 * * Description: * Repository for development of (mostly bleeding-edge) * multimedia packages for Gentoo Linux. This is the official overlay Traceback (most recent call last): File "/usr/bin/layman", line 37, in <module> main() File "/usr/bin/layman", line 34, in main Actions(Config()) File "/usr/lib64/python2.6/site-packages/layman/action.py", line 498, in __init__ result += i[1](config).run() File "/usr/lib64/python2.6/site-packages/layman/action.py", line 385, in run OUT.info(i[0], 1) File "/usr/lib64/python2.6/site-packages/layman/debug.py", line 308, in info print self.maybe_color('green', '* ') + i UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 35: ordinal not in range(128) I resolved that by editing /usr/lib64/python2.6/site-packages/layman/debug.py from print self.maybe_color('green', '* ') + i to print self.maybe_color('green', '* ') + i.encode('utf_8') After which it works when redirecting stdout (but again with "gentoo’s" becoming "gentooâs"). But I don't think hacking layman to play well with unicode is the way to go right now, what with the python3 unicode->str stuff. My attached patch for layman-global.txt makes it work w/ layman-1.2.3. It replaces the unicode apostrophe w/ ascii, and changes multimedia's description's white-space/line-wrapping to be more in-line w/ the rest of the file. Until it's applied on http://www.gentoo.org/proj/en/overlays/layman-global.txt, users can apply it to their local cache (for me it was /usr/local/portage/layman/cache_65bd38402ac8431067b54904bd2ed2d1.xml), and run "layman -nLv". Created attachment 206572 [details, diff] Patch for http://www.gentoo.org/proj/en/overlays/layman-global.txt This should be fixed now. app-portage/layman-1.2.4-r2 comes with a backport of the fix: please try it out and re-open this bug if necessary. Thanks for reporting! http://layman.git.sourceforge.net/git/gitweb.cgi?p=layman/layman;a=commitdiff;h=a4ce3e5d2076528950155069999873a92b87833e |