diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:19:54 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:19:54 +0200 |
commit | c158582c0fc7f4bd73980fe9adad446855f4d61b (patch) | |
tree | 31b701a2367cb983e76e76cd7c2ba176ad33e5ac /recipes-extra/python-urlgrabber/python-urlgrabber | |
download | meta-vt-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'recipes-extra/python-urlgrabber/python-urlgrabber')
-rw-r--r-- | recipes-extra/python-urlgrabber/python-urlgrabber/pycurl-curl.patch | 288 |
1 files changed, 288 insertions, 0 deletions
diff --git a/recipes-extra/python-urlgrabber/python-urlgrabber/pycurl-curl.patch b/recipes-extra/python-urlgrabber/python-urlgrabber/pycurl-curl.patch new file mode 100644 index 0000000..50f87e8 --- /dev/null +++ b/recipes-extra/python-urlgrabber/python-urlgrabber/pycurl-curl.patch | |||
@@ -0,0 +1,288 @@ | |||
1 | It seems that pycurl has been renamed to curl. | ||
2 | |||
3 | Signed-off-by: Jonas Eriksson <jonas.eriksson@enea.com> | ||
4 | Upstream-Status: Pending | ||
5 | diff -uNrp urlgrabber-3.10.1.orig/urlgrabber/grabber.py urlgrabber-3.10.1/urlgrabber/grabber.py | ||
6 | --- urlgrabber-3.10.1.orig/urlgrabber/grabber.py 2014-03-04 17:08:52.345678844 +0100 | ||
7 | +++ urlgrabber-3.10.1/urlgrabber/grabber.py 2014-03-04 17:09:49.074595399 +0100 | ||
8 | @@ -88,7 +88,7 @@ GENERAL ARGUMENTS (kwargs) | ||
9 | a positive integer expressing the number of seconds to wait before | ||
10 | timing out attempts to connect to a server. If the value is None | ||
11 | or 0, connection attempts will not time out. The timeout is passed | ||
12 | - to the underlying pycurl object as its CONNECTTIMEOUT option, see | ||
13 | + to the underlying curl object as its CONNECTTIMEOUT option, see | ||
14 | the curl documentation on CURLOPT_CONNECTTIMEOUT for more information. | ||
15 | http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTCONNECTTIMEOUT | ||
16 | |||
17 | @@ -509,7 +509,7 @@ import mimetools | ||
18 | import thread | ||
19 | import types | ||
20 | import stat | ||
21 | -import pycurl | ||
22 | +import curl | ||
23 | from ftplib import parse150 | ||
24 | from StringIO import StringIO | ||
25 | from httplib import HTTPException | ||
26 | @@ -821,7 +821,7 @@ class URLParser: | ||
27 | |||
28 | def process_http(self, parts, url): | ||
29 | (scheme, host, path, parm, query, frag) = parts | ||
30 | - # TODO: auth-parsing here, maybe? pycurl doesn't really need it | ||
31 | + # TODO: auth-parsing here, maybe? curl doesn't really need it | ||
32 | return (scheme, host, path, parm, query, frag) | ||
33 | |||
34 | def quote(self, parts): | ||
35 | @@ -983,7 +983,7 @@ class URLGrabberOptions: | ||
36 | self.username = None | ||
37 | self.password = None | ||
38 | self.ssl_ca_cert = None # sets SSL_CAINFO - path to certdb | ||
39 | - self.ssl_context = None # no-op in pycurl | ||
40 | + self.ssl_context = None # no-op in curl | ||
41 | self.ssl_verify_peer = True # check peer's cert for authenticityb | ||
42 | self.ssl_verify_host = True # make sure who they are and who the cert is for matches | ||
43 | self.ssl_key = None # client key | ||
44 | @@ -1355,7 +1355,7 @@ class PyCurlFileObject(object): | ||
45 | |||
46 | return len(buf) | ||
47 | except KeyboardInterrupt: | ||
48 | - return pycurl.READFUNC_ABORT | ||
49 | + return curl.READFUNC_ABORT | ||
50 | |||
51 | def _return_hdr_obj(self): | ||
52 | if self._parsed_hdr: | ||
53 | @@ -1370,7 +1370,7 @@ class PyCurlFileObject(object): | ||
54 | |||
55 | hdr = property(_return_hdr_obj) | ||
56 | http_code = property(fget= | ||
57 | - lambda self: self.curl_obj.getinfo(pycurl.RESPONSE_CODE)) | ||
58 | + lambda self: self.curl_obj.getinfo(curl.RESPONSE_CODE)) | ||
59 | |||
60 | def _set_opts(self, opts={}): | ||
61 | # XXX | ||
62 | @@ -1379,109 +1379,109 @@ class PyCurlFileObject(object): | ||
63 | |||
64 | # keepalives | ||
65 | if not opts.keepalive: | ||
66 | - self.curl_obj.setopt(pycurl.FORBID_REUSE, 1) | ||
67 | + self.curl_obj.setopt(curl.FORBID_REUSE, 1) | ||
68 | |||
69 | # defaults we're always going to set | ||
70 | - self.curl_obj.setopt(pycurl.NOPROGRESS, False) | ||
71 | - self.curl_obj.setopt(pycurl.NOSIGNAL, True) | ||
72 | - self.curl_obj.setopt(pycurl.WRITEFUNCTION, self._retrieve) | ||
73 | - self.curl_obj.setopt(pycurl.HEADERFUNCTION, self._hdr_retrieve) | ||
74 | - self.curl_obj.setopt(pycurl.PROGRESSFUNCTION, self._progress_update) | ||
75 | - self.curl_obj.setopt(pycurl.FAILONERROR, True) | ||
76 | - self.curl_obj.setopt(pycurl.OPT_FILETIME, True) | ||
77 | - self.curl_obj.setopt(pycurl.FOLLOWLOCATION, True) | ||
78 | + self.curl_obj.setopt(curl.NOPROGRESS, False) | ||
79 | + self.curl_obj.setopt(curl.NOSIGNAL, True) | ||
80 | + self.curl_obj.setopt(curl.WRITEFUNCTION, self._retrieve) | ||
81 | + self.curl_obj.setopt(curl.HEADERFUNCTION, self._hdr_retrieve) | ||
82 | + self.curl_obj.setopt(curl.PROGRESSFUNCTION, self._progress_update) | ||
83 | + self.curl_obj.setopt(curl.FAILONERROR, True) | ||
84 | + self.curl_obj.setopt(curl.OPT_FILETIME, True) | ||
85 | + self.curl_obj.setopt(curl.FOLLOWLOCATION, True) | ||
86 | |||
87 | if DEBUG and DEBUG.level <= 10: | ||
88 | - self.curl_obj.setopt(pycurl.VERBOSE, True) | ||
89 | + self.curl_obj.setopt(curl.VERBOSE, True) | ||
90 | if opts.user_agent: | ||
91 | - self.curl_obj.setopt(pycurl.USERAGENT, opts.user_agent) | ||
92 | + self.curl_obj.setopt(curl.USERAGENT, opts.user_agent) | ||
93 | if opts.ip_resolve: | ||
94 | # Default is: IPRESOLVE_WHATEVER | ||
95 | ipr = opts.ip_resolve.lower() | ||
96 | if ipr == 'whatever': # Do we need this? | ||
97 | - self.curl_obj.setopt(pycurl.IPRESOLVE,pycurl.IPRESOLVE_WHATEVER) | ||
98 | + self.curl_obj.setopt(curl.IPRESOLVE,curl.IPRESOLVE_WHATEVER) | ||
99 | if ipr == 'ipv4': | ||
100 | - self.curl_obj.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V4) | ||
101 | + self.curl_obj.setopt(curl.IPRESOLVE, curl.IPRESOLVE_V4) | ||
102 | if ipr == 'ipv6': | ||
103 | - self.curl_obj.setopt(pycurl.IPRESOLVE, pycurl.IPRESOLVE_V6) | ||
104 | + self.curl_obj.setopt(curl.IPRESOLVE, curl.IPRESOLVE_V6) | ||
105 | |||
106 | # maybe to be options later | ||
107 | - self.curl_obj.setopt(pycurl.FOLLOWLOCATION, True) | ||
108 | - self.curl_obj.setopt(pycurl.MAXREDIRS, 5) | ||
109 | + self.curl_obj.setopt(curl.FOLLOWLOCATION, True) | ||
110 | + self.curl_obj.setopt(curl.MAXREDIRS, 5) | ||
111 | |||
112 | # timeouts | ||
113 | timeout = 300 | ||
114 | if hasattr(opts, 'timeout'): | ||
115 | timeout = int(opts.timeout or 0) | ||
116 | - self.curl_obj.setopt(pycurl.CONNECTTIMEOUT, timeout) | ||
117 | - self.curl_obj.setopt(pycurl.LOW_SPEED_LIMIT, opts.minrate or 1000) | ||
118 | - self.curl_obj.setopt(pycurl.LOW_SPEED_TIME, timeout) | ||
119 | + self.curl_obj.setopt(curl.CONNECTTIMEOUT, timeout) | ||
120 | + self.curl_obj.setopt(curl.LOW_SPEED_LIMIT, opts.minrate or 1000) | ||
121 | + self.curl_obj.setopt(curl.LOW_SPEED_TIME, timeout) | ||
122 | |||
123 | # ssl options | ||
124 | if self.scheme == 'https': | ||
125 | if opts.ssl_ca_cert: # this may do ZERO with nss according to curl docs | ||
126 | - self.curl_obj.setopt(pycurl.CAPATH, opts.ssl_ca_cert) | ||
127 | - self.curl_obj.setopt(pycurl.CAINFO, opts.ssl_ca_cert) | ||
128 | - self.curl_obj.setopt(pycurl.SSL_VERIFYPEER, opts.ssl_verify_peer) | ||
129 | + self.curl_obj.setopt(curl.CAPATH, opts.ssl_ca_cert) | ||
130 | + self.curl_obj.setopt(curl.CAINFO, opts.ssl_ca_cert) | ||
131 | + self.curl_obj.setopt(curl.SSL_VERIFYPEER, opts.ssl_verify_peer) | ||
132 | if opts.ssl_verify_host: # 1 is meaningless to curl | ||
133 | - self.curl_obj.setopt(pycurl.SSL_VERIFYHOST, 2) | ||
134 | + self.curl_obj.setopt(curl.SSL_VERIFYHOST, 2) | ||
135 | if opts.ssl_key: | ||
136 | - self.curl_obj.setopt(pycurl.SSLKEY, opts.ssl_key) | ||
137 | + self.curl_obj.setopt(curl.SSLKEY, opts.ssl_key) | ||
138 | if opts.ssl_key_type: | ||
139 | - self.curl_obj.setopt(pycurl.SSLKEYTYPE, opts.ssl_key_type) | ||
140 | + self.curl_obj.setopt(curl.SSLKEYTYPE, opts.ssl_key_type) | ||
141 | if opts.ssl_cert: | ||
142 | - self.curl_obj.setopt(pycurl.SSLCERT, opts.ssl_cert) | ||
143 | + self.curl_obj.setopt(curl.SSLCERT, opts.ssl_cert) | ||
144 | # if we have a client side cert - turn off reuse b/c nss is odd | ||
145 | - self.curl_obj.setopt(pycurl.FORBID_REUSE, 1) | ||
146 | + self.curl_obj.setopt(curl.FORBID_REUSE, 1) | ||
147 | if opts.ssl_cert_type: | ||
148 | - self.curl_obj.setopt(pycurl.SSLCERTTYPE, opts.ssl_cert_type) | ||
149 | + self.curl_obj.setopt(curl.SSLCERTTYPE, opts.ssl_cert_type) | ||
150 | if opts.ssl_key_pass: | ||
151 | - self.curl_obj.setopt(pycurl.SSLKEYPASSWD, opts.ssl_key_pass) | ||
152 | + self.curl_obj.setopt(curl.SSLKEYPASSWD, opts.ssl_key_pass) | ||
153 | |||
154 | #headers: | ||
155 | if opts.http_headers and self.scheme in ('http', 'https'): | ||
156 | headers = [] | ||
157 | for (tag, content) in opts.http_headers: | ||
158 | headers.append('%s:%s' % (tag, content)) | ||
159 | - self.curl_obj.setopt(pycurl.HTTPHEADER, headers) | ||
160 | + self.curl_obj.setopt(curl.HTTPHEADER, headers) | ||
161 | |||
162 | # ranges: | ||
163 | if opts.range or opts.reget: | ||
164 | range_str = self._build_range() | ||
165 | if range_str: | ||
166 | - self.curl_obj.setopt(pycurl.RANGE, range_str) | ||
167 | + self.curl_obj.setopt(curl.RANGE, range_str) | ||
168 | |||
169 | # throttle/bandwidth | ||
170 | if hasattr(opts, 'raw_throttle') and opts.raw_throttle(): | ||
171 | - self.curl_obj.setopt(pycurl.MAX_RECV_SPEED_LARGE, int(opts.raw_throttle())) | ||
172 | + self.curl_obj.setopt(curl.MAX_RECV_SPEED_LARGE, int(opts.raw_throttle())) | ||
173 | |||
174 | # proxy | ||
175 | if opts.proxy is not None: | ||
176 | - self.curl_obj.setopt(pycurl.PROXY, opts.proxy) | ||
177 | - self.curl_obj.setopt(pycurl.PROXYAUTH, | ||
178 | + self.curl_obj.setopt(curl.PROXY, opts.proxy) | ||
179 | + self.curl_obj.setopt(curl.PROXYAUTH, | ||
180 | # All but Kerberos. BZ 769254 | ||
181 | - pycurl.HTTPAUTH_ANY - pycurl.HTTPAUTH_GSSNEGOTIATE) | ||
182 | + curl.HTTPAUTH_ANY - curl.HTTPAUTH_GSSNEGOTIATE) | ||
183 | |||
184 | if opts.username and opts.password: | ||
185 | if self.scheme in ('http', 'https'): | ||
186 | - self.curl_obj.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_ANY) | ||
187 | + self.curl_obj.setopt(curl.HTTPAUTH, curl.HTTPAUTH_ANY) | ||
188 | |||
189 | if opts.username and opts.password: | ||
190 | # apparently when applying them as curlopts they do not require quoting of any kind | ||
191 | userpwd = '%s:%s' % (opts.username, opts.password) | ||
192 | - self.curl_obj.setopt(pycurl.USERPWD, userpwd) | ||
193 | + self.curl_obj.setopt(curl.USERPWD, userpwd) | ||
194 | |||
195 | #posts - simple - expects the fields as they are | ||
196 | if opts.data: | ||
197 | - self.curl_obj.setopt(pycurl.POST, True) | ||
198 | - self.curl_obj.setopt(pycurl.POSTFIELDS, _to_utf8(opts.data)) | ||
199 | + self.curl_obj.setopt(curl.POST, True) | ||
200 | + self.curl_obj.setopt(curl.POSTFIELDS, _to_utf8(opts.data)) | ||
201 | |||
202 | # ftp | ||
203 | if opts.ftp_disable_epsv: | ||
204 | - self.curl_obj.setopt(pycurl.FTP_USE_EPSV, False) | ||
205 | + self.curl_obj.setopt(curl.FTP_USE_EPSV, False) | ||
206 | |||
207 | # our url | ||
208 | - self.curl_obj.setopt(pycurl.URL, self.url) | ||
209 | + self.curl_obj.setopt(curl.URL, self.url) | ||
210 | |||
211 | |||
212 | def _do_perform(self): | ||
213 | @@ -1490,7 +1490,7 @@ class PyCurlFileObject(object): | ||
214 | |||
215 | try: | ||
216 | self.curl_obj.perform() | ||
217 | - except pycurl.error, e: | ||
218 | + except curl.error, e: | ||
219 | # XXX - break some of these out a bit more clearly | ||
220 | # to other URLGrabErrors from | ||
221 | # http://curl.haxx.se/libcurl/c/libcurl-errors.html | ||
222 | @@ -1505,11 +1505,11 @@ class PyCurlFileObject(object): | ||
223 | |||
224 | if errcode == 23 and 200 <= code <= 299: | ||
225 | # this is probably wrong but ultimately this is what happens | ||
226 | - # we have a legit http code and a pycurl 'writer failed' code | ||
227 | + # we have a legit http code and a curl 'writer failed' code | ||
228 | # which almost always means something aborted it from outside | ||
229 | # since we cannot know what it is -I'm banking on it being | ||
230 | # a ctrl-c. XXXX - if there's a way of going back two raises to | ||
231 | - # figure out what aborted the pycurl process FIXME | ||
232 | + # figure out what aborted the curl process FIXME | ||
233 | raise getattr(self, '_cb_error', KeyboardInterrupt) | ||
234 | |||
235 | elif errcode == 28: | ||
236 | @@ -1519,11 +1519,11 @@ class PyCurlFileObject(object): | ||
237 | |||
238 | elif errcode == 42: | ||
239 | # this is probably wrong but ultimately this is what happens | ||
240 | - # we have a legit http code and a pycurl 'writer failed' code | ||
241 | + # we have a legit http code and a curl 'writer failed' code | ||
242 | # which almost always means something aborted it from outside | ||
243 | # since we cannot know what it is -I'm banking on it being | ||
244 | # a ctrl-c. XXXX - if there's a way of going back two raises to | ||
245 | - # figure out what aborted the pycurl process FIXME | ||
246 | + # figure out what aborted the curl process FIXME | ||
247 | raise KeyboardInterrupt | ||
248 | |||
249 | else: | ||
250 | @@ -1750,7 +1750,7 @@ class PyCurlFileObject(object): | ||
251 | pass # URL too long. = IOError ... ignore everything. | ||
252 | |||
253 | # set the time | ||
254 | - mod_time = self.curl_obj.getinfo(pycurl.INFO_FILETIME) | ||
255 | + mod_time = self.curl_obj.getinfo(curl.INFO_FILETIME) | ||
256 | if mod_time != -1: | ||
257 | try: | ||
258 | os.utime(self.filename, (mod_time, mod_time)) | ||
259 | @@ -1863,7 +1863,7 @@ class PyCurlFileObject(object): | ||
260 | |||
261 | msg = _("Downloaded more than max size for %s: %s > %s") \ | ||
262 | % (self.url, cur, max_size) | ||
263 | - self._error = (pycurl.E_FILESIZE_EXCEEDED, msg) | ||
264 | + self._error = (curl.E_FILESIZE_EXCEEDED, msg) | ||
265 | return True | ||
266 | return False | ||
267 | |||
268 | @@ -1903,16 +1903,16 @@ class PyCurlFileObject(object): | ||
269 | urllib.addinfourl, via. urllib.URLopener.* """ | ||
270 | return self.url | ||
271 | |||
272 | -if hasattr(pycurl, 'GLOBAL_ACK_EINTR'): | ||
273 | +if hasattr(curl, 'GLOBAL_ACK_EINTR'): | ||
274 | # fail immediately on ctrl-c | ||
275 | - pycurl.global_init(pycurl.GLOBAL_DEFAULT | pycurl.GLOBAL_ACK_EINTR) | ||
276 | -_curl_cache = pycurl.Curl() # make one and reuse it over and over and over | ||
277 | + curl.global_init(curl.GLOBAL_DEFAULT | curl.GLOBAL_ACK_EINTR) | ||
278 | +_curl_cache = curl.Curl() # make one and reuse it over and over and over | ||
279 | |||
280 | def reset_curl_obj(): | ||
281 | """To make sure curl has reread the network/dns info we force a reload""" | ||
282 | global _curl_cache | ||
283 | _curl_cache.close() | ||
284 | - _curl_cache = pycurl.Curl() | ||
285 | + _curl_cache = curl.Curl() | ||
286 | |||
287 | _libproxy_cache = None | ||
288 | |||