Signed-off-by: Aaron Bauman <b...@gentoo.org> --- lib/portage/getbinpkg.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/lib/portage/getbinpkg.py b/lib/portage/getbinpkg.py index 54b918a65..d588b324b 100644 --- a/lib/portage/getbinpkg.py +++ b/lib/portage/getbinpkg.py @@ -1,5 +1,5 @@ # getbinpkg.py -- Portage binary-package helper functions -# Copyright 2003-2014 Gentoo Foundation +# Copyright 2003-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.output import colorize @@ -52,7 +52,7 @@ def make_metadata_dict(data): DeprecationWarning, stacklevel=2) myid, _myglob = data - + mydict = {} for k_bytes in portage.xpak.getindex_mem(myid): k = _unicode_decode(k_bytes, @@ -78,7 +78,7 @@ class ParseLinks(html_parser_HTMLParser): def get_anchors(self): return self.PL_anchors - + def get_anchors_by_prefix(self, prefix): newlist = [] for x in self.PL_anchors: @@ -86,7 +86,7 @@ class ParseLinks(html_parser_HTMLParser): if x not in newlist: newlist.append(x[:]) return newlist - + def get_anchors_by_suffix(self, suffix): newlist = [] for x in self.PL_anchors: @@ -94,7 +94,7 @@ class ParseLinks(html_parser_HTMLParser): if x not in newlist: newlist.append(x[:]) return newlist - + def handle_endtag(self, tag): pass @@ -215,10 +215,10 @@ def make_ftp_request(conn, address, rest=None, dest=None): DeprecationWarning, stacklevel=2) try: - + if dest: fstart_pos = dest.tell() - + conn.voidcmd("TYPE I") fsize = conn.size(address) @@ -256,7 +256,7 @@ def make_ftp_request(conn, address, rest=None, dest=None): except ValueError as e: return None, int(str(e)[:4]), str(e) - + def make_http_request(conn, address, _params={}, headers={}, dest=None): """Uses the |conn| object to request @@ -296,7 +296,7 @@ def make_http_request(conn, address, _params={}, headers={}, dest=None): str(parts[1]) + "\n") address = parts[1] break - + if (rc != 200) and (rc != 206): return None, rc, "Server did not respond successfully (%s: %s)" % (str(response.status), str(response.reason)) @@ -313,10 +313,10 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): DeprecationWarning, stacklevel=2) myarray = [] - + if not (prefix and suffix): match_both = 0 - + for x in array: add_p = 0 if prefix and (len(x) >= len(prefix)) and (x[:len(prefix)] == prefix): @@ -337,7 +337,7 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): continue # Too short to match. else: pass # Do whatever... We're overlapping. - + if suffix and (len(x) >= len(suffix)) and (x[-len(suffix):] == suffix): myarray.append(x) # It matches else: @@ -368,7 +368,7 @@ def dir_get_list(baseurl, conn=None): # if the address doesn't end with a slash. address += "/" page, rc, msg = make_http_request(conn, address, params, headers) - + if page: parser = ParseLinks() parser.feed(_unicode_decode(page)) @@ -426,7 +426,7 @@ def file_get_metadata(baseurl, conn=None, chunk_size=3000): f.close() else: raise TypeError(_("Unknown protocol. '%s'") % protocol) - + if data: xpaksize = portage.xpak.decodeint(data[-8:-4]) if (xpaksize + 8) > chunk_size: @@ -544,7 +544,7 @@ def file_get_lib(baseurl, dest, conn=None): f.close() else: raise TypeError(_("Unknown protocol. '%s'") % protocol) - + if not keepconnection: conn.close() @@ -621,7 +621,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= tbz2list = match_in_array(filelist, suffix=".tbz2") metalist = match_in_array(filelist, prefix="metadata.idx") del filelist - + # Determine if our metadata file is current. metalist.sort() metalist.reverse() # makes the order new-to-old. @@ -785,7 +785,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= if not keepconnection: conn.close() - + return metadata[baseurl]["data"] def _cmp_cpv(d1, d2): -- 2.28.0