From 58eb89592bfc3ac40ac0235ebcc52910b51a826c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 8 Sep 2011 21:05:58 -0700 Subject: [PATCH] getbinpkg: fix old binhost protocol for python3 This will fix bug #382233. --- pym/portage/getbinpkg.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 3e5867223..579a46f9b 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -8,7 +8,9 @@ from portage.localization import _ import portage from portage import os from portage import _encodings +from portage import _unicode_decode from portage import _unicode_encode +from _emerge.Package import _all_metadata_keys import sys import socket @@ -65,8 +67,15 @@ def make_metadata_dict(data): myid,myglob = data mydict = {} - for x in portage.xpak.getindex_mem(myid): - mydict[x] = portage.xpak.getitem(data,x) + for k_bytes in portage.xpak.getindex_mem(myid): + k = _unicode_decode(k_bytes, + encoding=_encodings['repo.content'], errors='replace') + if k not in _all_metadata_keys and \ + k != "CATEGORY": + continue + v = _unicode_decode(portage.xpak.getitem(data, k_bytes), + encoding=_encodings['repo.content'], errors='replace') + mydict[k] = v return mydict @@ -354,7 +363,7 @@ def dir_get_list(baseurl,conn=None): if page: parser = ParseLinks() - parser.feed(page) + parser.feed(_unicode_decode(page)) del page listing = parser.get_anchors() else: -- 2.26.2