1 |
Signed-off-by: Aaron Bauman <bman@g.o> |
2 |
--- |
3 |
lib/portage/getbinpkg.py | 34 +++++++++++++++++----------------- |
4 |
1 file changed, 17 insertions(+), 17 deletions(-) |
5 |
|
6 |
diff --git a/lib/portage/getbinpkg.py b/lib/portage/getbinpkg.py |
7 |
index 54b918a65..d588b324b 100644 |
8 |
--- a/lib/portage/getbinpkg.py |
9 |
+++ b/lib/portage/getbinpkg.py |
10 |
@@ -1,5 +1,5 @@ |
11 |
# getbinpkg.py -- Portage binary-package helper functions |
12 |
-# Copyright 2003-2014 Gentoo Foundation |
13 |
+# Copyright 2003-2020 Gentoo Authors |
14 |
# Distributed under the terms of the GNU General Public License v2 |
15 |
|
16 |
from portage.output import colorize |
17 |
@@ -52,7 +52,7 @@ def make_metadata_dict(data): |
18 |
DeprecationWarning, stacklevel=2) |
19 |
|
20 |
myid, _myglob = data |
21 |
- |
22 |
+ |
23 |
mydict = {} |
24 |
for k_bytes in portage.xpak.getindex_mem(myid): |
25 |
k = _unicode_decode(k_bytes, |
26 |
@@ -78,7 +78,7 @@ class ParseLinks(html_parser_HTMLParser): |
27 |
|
28 |
def get_anchors(self): |
29 |
return self.PL_anchors |
30 |
- |
31 |
+ |
32 |
def get_anchors_by_prefix(self, prefix): |
33 |
newlist = [] |
34 |
for x in self.PL_anchors: |
35 |
@@ -86,7 +86,7 @@ class ParseLinks(html_parser_HTMLParser): |
36 |
if x not in newlist: |
37 |
newlist.append(x[:]) |
38 |
return newlist |
39 |
- |
40 |
+ |
41 |
def get_anchors_by_suffix(self, suffix): |
42 |
newlist = [] |
43 |
for x in self.PL_anchors: |
44 |
@@ -94,7 +94,7 @@ class ParseLinks(html_parser_HTMLParser): |
45 |
if x not in newlist: |
46 |
newlist.append(x[:]) |
47 |
return newlist |
48 |
- |
49 |
+ |
50 |
def handle_endtag(self, tag): |
51 |
pass |
52 |
|
53 |
@@ -215,10 +215,10 @@ def make_ftp_request(conn, address, rest=None, dest=None): |
54 |
DeprecationWarning, stacklevel=2) |
55 |
|
56 |
try: |
57 |
- |
58 |
+ |
59 |
if dest: |
60 |
fstart_pos = dest.tell() |
61 |
- |
62 |
+ |
63 |
conn.voidcmd("TYPE I") |
64 |
fsize = conn.size(address) |
65 |
|
66 |
@@ -256,7 +256,7 @@ def make_ftp_request(conn, address, rest=None, dest=None): |
67 |
|
68 |
except ValueError as e: |
69 |
return None, int(str(e)[:4]), str(e) |
70 |
- |
71 |
+ |
72 |
|
73 |
def make_http_request(conn, address, _params={}, headers={}, dest=None): |
74 |
"""Uses the |conn| object to request |
75 |
@@ -296,7 +296,7 @@ def make_http_request(conn, address, _params={}, headers={}, dest=None): |
76 |
str(parts[1]) + "\n") |
77 |
address = parts[1] |
78 |
break |
79 |
- |
80 |
+ |
81 |
if (rc != 200) and (rc != 206): |
82 |
return None, rc, "Server did not respond successfully (%s: %s)" % (str(response.status), str(response.reason)) |
83 |
|
84 |
@@ -313,10 +313,10 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): |
85 |
DeprecationWarning, stacklevel=2) |
86 |
|
87 |
myarray = [] |
88 |
- |
89 |
+ |
90 |
if not (prefix and suffix): |
91 |
match_both = 0 |
92 |
- |
93 |
+ |
94 |
for x in array: |
95 |
add_p = 0 |
96 |
if prefix and (len(x) >= len(prefix)) and (x[:len(prefix)] == prefix): |
97 |
@@ -337,7 +337,7 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): |
98 |
continue # Too short to match. |
99 |
else: |
100 |
pass # Do whatever... We're overlapping. |
101 |
- |
102 |
+ |
103 |
if suffix and (len(x) >= len(suffix)) and (x[-len(suffix):] == suffix): |
104 |
myarray.append(x) # It matches |
105 |
else: |
106 |
@@ -368,7 +368,7 @@ def dir_get_list(baseurl, conn=None): |
107 |
# if the address doesn't end with a slash. |
108 |
address += "/" |
109 |
page, rc, msg = make_http_request(conn, address, params, headers) |
110 |
- |
111 |
+ |
112 |
if page: |
113 |
parser = ParseLinks() |
114 |
parser.feed(_unicode_decode(page)) |
115 |
@@ -426,7 +426,7 @@ def file_get_metadata(baseurl, conn=None, chunk_size=3000): |
116 |
f.close() |
117 |
else: |
118 |
raise TypeError(_("Unknown protocol. '%s'") % protocol) |
119 |
- |
120 |
+ |
121 |
if data: |
122 |
xpaksize = portage.xpak.decodeint(data[-8:-4]) |
123 |
if (xpaksize + 8) > chunk_size: |
124 |
@@ -544,7 +544,7 @@ def file_get_lib(baseurl, dest, conn=None): |
125 |
f.close() |
126 |
else: |
127 |
raise TypeError(_("Unknown protocol. '%s'") % protocol) |
128 |
- |
129 |
+ |
130 |
if not keepconnection: |
131 |
conn.close() |
132 |
|
133 |
@@ -621,7 +621,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= |
134 |
tbz2list = match_in_array(filelist, suffix=".tbz2") |
135 |
metalist = match_in_array(filelist, prefix="metadata.idx") |
136 |
del filelist |
137 |
- |
138 |
+ |
139 |
# Determine if our metadata file is current. |
140 |
metalist.sort() |
141 |
metalist.reverse() # makes the order new-to-old. |
142 |
@@ -785,7 +785,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= |
143 |
|
144 |
if not keepconnection: |
145 |
conn.close() |
146 |
- |
147 |
+ |
148 |
return metadata[baseurl]["data"] |
149 |
|
150 |
def _cmp_cpv(d1, d2): |
151 |
-- |
152 |
2.28.0 |