forked from pool/python-urlgrabber
- Drop patch grabber_fix.diff that was never upstreamed. Should
not be needed anymore OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urlgrabber?expand=0&rev=32
This commit is contained in:
committed by
Git OBS Bridge
parent
4192a3124d
commit
d12eed8207
@@ -1,87 +0,0 @@
|
||||
--- a/urlgrabber/grabber.py
|
||||
+++ b/urlgrabber/grabber.py
|
||||
@@ -594,6 +594,12 @@ def _urlunquote_convert(s):
|
||||
s = s.decode('utf8')
|
||||
return urlunquote(s)
|
||||
|
||||
+try:
|
||||
+ # this part isn't going to do much - need to talk to gettext
|
||||
+ from i18n import _
|
||||
+except ImportError, msg:
|
||||
+ def _(st): return st
|
||||
+
|
||||
########################################################################
|
||||
# MODULE INITIALIZATION
|
||||
########################################################################
|
||||
@@ -1298,6 +1304,12 @@ class URLGrabber(object):
|
||||
_('Exceeded limit (%i): %s') % (limit, url))
|
||||
err.url = url
|
||||
raise err
|
||||
+ else:
|
||||
+ if self._error[1]:
|
||||
+ msg = self._error[1]
|
||||
+ err = URLGRabError(14, msg)
|
||||
+ err.url = self.url
|
||||
+ raise err
|
||||
|
||||
return s
|
||||
|
||||
@@ -1342,6 +1354,10 @@ class PyCurlFileObject(object):
|
||||
self._tm_last = None
|
||||
self._do_open()
|
||||
|
||||
+ def geturl(self):
|
||||
+ """ Provide the geturl() method, used to be got from
|
||||
+ urllib.addinfourl, via. urllib.URLopener.* """
|
||||
+ return self.url
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""This effectively allows us to wrap at the instance level.
|
||||
@@ -1391,7 +1407,7 @@ class PyCurlFileObject(object):
|
||||
|
||||
def _hdr_retrieve(self, buf):
|
||||
if self._hdr_ended:
|
||||
- self._hdr_dump = b''
|
||||
+ self._hdr_dump = ''
|
||||
self.size = 0
|
||||
self._hdr_ended = False
|
||||
|
||||
@@ -1426,16 +1442,15 @@ class PyCurlFileObject(object):
|
||||
if s:
|
||||
self.size = int(s)
|
||||
|
||||
- if buf.lower().find(b'location') != -1:
|
||||
- location = b':'.join(buf.split(b':')[1:])
|
||||
+ if buf.lower().find('location') != -1:
|
||||
+ location = ':'.join(buf.split(':')[1:])
|
||||
location = location.strip()
|
||||
self.scheme = urlparse.urlsplit(location)[0]
|
||||
self.url = location
|
||||
|
||||
- self._hdr_dump += buf
|
||||
- if len(self._hdr_dump) != 0 and buf == b'\r\n':
|
||||
+ if len(self._hdr_dump) != 0 and buf == '\r\n':
|
||||
self._hdr_ended = True
|
||||
- if DEBUG: DEBUG.debug('header ended:')
|
||||
+ if DEBUG: DEBUG.info('header ended:')
|
||||
|
||||
return len(buf)
|
||||
except KeyboardInterrupt:
|
||||
@@ -1444,7 +1459,7 @@ class PyCurlFileObject(object):
|
||||
def _return_hdr_obj(self):
|
||||
if self._parsed_hdr:
|
||||
return self._parsed_hdr
|
||||
- statusend = self._hdr_dump.find(b'\n')
|
||||
+ statusend = self._hdr_dump.find('\n')
|
||||
statusend += 1 # ridiculous as it may seem.
|
||||
hdrfp = StringIO()
|
||||
hdrfp.write(self._hdr_dump[statusend:])
|
||||
@@ -1498,7 +1513,7 @@ class PyCurlFileObject(object):
|
||||
if hasattr(opts, 'timeout'):
|
||||
timeout = int(opts.timeout or 0)
|
||||
self.curl_obj.setopt(pycurl.CONNECTTIMEOUT, timeout)
|
||||
- self.curl_obj.setopt(pycurl.LOW_SPEED_LIMIT, opts.minrate or 1000)
|
||||
+ self.curl_obj.setopt(pycurl.LOW_SPEED_LIMIT, 1)
|
||||
self.curl_obj.setopt(pycurl.LOW_SPEED_TIME, timeout)
|
||||
|
||||
# ssl options
|
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 27 09:39:32 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
- Drop patch grabber_fix.diff that was never upstreamed. Should
|
||||
not be needed anymore
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Feb 25 17:44:43 CET 2019 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@@ -16,11 +16,8 @@
|
||||
#
|
||||
|
||||
|
||||
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define skip_python3 1
|
||||
%define modname urlgrabber
|
||||
|
||||
Name: python-urlgrabber
|
||||
Version: 4.0.0
|
||||
Release: 0
|
||||
@@ -29,7 +26,6 @@ License: LGPL-2.1-only
|
||||
Group: Development/Languages/Python
|
||||
URL: http://urlgrabber.baseurl.org
|
||||
Source: https://github.com/rpm-software-management/%{modname}/releases/download/%{modname}-4-0-0/%{modname}-%{version}.tar.gz
|
||||
Patch0: grabber_fix.diff
|
||||
BuildRequires: %{python_module pycurl}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module six}
|
||||
@@ -46,8 +42,8 @@ throttling, authentication, proxies and more.
|
||||
|
||||
%prep
|
||||
%setup -q -n urlgrabber-%{version}
|
||||
# Remove with next release
|
||||
sed -i "13d" urlgrabber/__init__.py # Remove wrong license header, fixes bnc#781323
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
%python_build
|
||||
@@ -61,8 +57,8 @@ mv -v %{buildroot}%{_usr}/libexec/urlgrabber-ext-down %{buildroot}%{_usr}/lib/ur
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc ChangeLog README TODO
|
||||
%{_bindir}/urlgrabber
|
||||
%python3_only %{_bindir}/urlgrabber
|
||||
%{python_sitelib}/*
|
||||
%{_usr}/lib/urlgrabber*
|
||||
%python3_only %{_prefix}/lib/urlgrabber*
|
||||
|
||||
%changelog
|
||||
|
Reference in New Issue
Block a user