Hello community,

here is the log from the commit of package python3-requests for 
openSUSE:Factory checked in at 2016-03-26 15:08:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-requests (Old)
 and      /work/SRC/openSUSE:Factory/.python3-requests.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python3-requests"

Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-requests/python3-requests.changes        
2016-02-25 21:51:12.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.python3-requests.new/python3-requests.changes   
2016-03-26 15:08:26.000000000 +0100
@@ -1,0 +2,15 @@
+Mon Mar  7 19:26:34 UTC 2016 - jmate...@suse.com
+
+- modify no-default-cacert.patch again, to perform passthrough
+  of empty parameters if cert path is not specified
+- modify requests-do-not-use-bundle.patch to use built-in facilities
+  to exclude the bundles, and to keep requests.packages
+- modify patches to change setup.py to facilitate their functions
+- reenable tests, add python3-pytest as requirement
+- recommend ca-certificates-mozilla, require ca-certificates
+  everywhere (also apply no-default-cacert everywhere)
+- make sure requirements in egg-info are set right, and that
+  the package depends on good-enough version of urllib3
+  (see PACKAGING_NOTES for details)
+
+-------------------------------------------------------------------

New:
----
  PACKAGING_NOTES
  set_urllib3_version.sh

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python3-requests.spec ++++++
--- /var/tmp/diff_new_pack.ANF4aC/_old  2016-03-26 15:08:27.000000000 +0100
+++ /var/tmp/diff_new_pack.ANF4aC/_new  2016-03-26 15:08:27.000000000 +0100
@@ -16,6 +16,8 @@
 #
 
 
+%define urllib3_version 1.13.1
+
 Name:           python3-requests
 Version:        2.9.1
 Release:        0
@@ -24,6 +26,8 @@
 Group:          Development/Languages/Python
 Url:            http://python-requests.org/
 Source:         
http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz
+Source100:      PACKAGING_NOTES
+Source101:      set_urllib3_version.sh
 # PATCH-FIX-OPENSUSE no-default-cacert.patch -- Completely ignore the internal 
CA bundle.
 Patch0:         no-default-cacert.patch
 # PATCH-FIX-OPENSUSE requests-do-not-use-bundle.patch -- Use system libraries 
instead of bundled ones.
@@ -34,20 +38,15 @@
 BuildRequires:  python3-devel
 BuildRequires:  python3-py
 BuildRequires:  python3-setuptools
-BuildRequires:  python3-urllib3
+BuildRequires:  python3-urllib3 >= %{urllib3_version}
+# test requires
+BuildRequires:  python3-pytest
 Requires:       ca-certificates
+Recommends:     ca-certificates-mozilla
 Requires:       python3-chardet
 Requires:       python3-py
-# Really needed?
-#Requires:       python3-ndg-httpsclient
-Requires:       python3-pyOpenSSL
-Requires:       python3-pyasn1
-Requires:       python3-urllib3
+Requires:       python3-urllib3 >= %{urllib3_version}
 BuildArch:      noarch
-%if !(0%{?suse_version} == 1315 && !0%{?is_opensuse})
-BuildRequires:  ca-certificates
-Requires:       ca-certificates
-%endif
 
 %description
 Requests is an ISC Licensed HTTP library, written in Python, for
@@ -74,11 +73,13 @@
 
 %prep
 %setup -q -n requests-%{version}
-%if !(0%{?suse_version} == 1315 && !0%{?is_opensuse})
 %patch0 -p1
-rm -f requests/cacert.pem
-%endif
 %patch1 -p1
+rm -f requests/cacert.pem
+
+# fill out required urllib3 version
+sed -i s/#URLLIB3VERSION#/%{urllib3_version}/ setup.py
+echo "urllib3 >= %{urllib3_version}" >> requirements.txt
 
 %build
 python3 setup.py build
@@ -86,16 +87,28 @@
 %install
 python3 setup.py install \
   --root=%{buildroot} --prefix=%{_prefix}
-rm -rf %{buildroot}%{python3_sitelib}/requests/packages/
+# check that urllib3 is not installed
+test ! -e %{buildroot}%{python3_sitelib}/requests/packages/urllib3
 
-# Tests require network access.
-# %check
-# python3 test_requests.py
+%check
+# first check that we have a good version of urllib3
+# DO NOT DISABLE THIS TEST unless you know what you are doing
+# see PACKAGING_NOTES for details
+python3 <<END
+import sys, pkg_resources
+from requests.packages.urllib3 import __version__
+required = "urllib3 >= {}".format(__version__)
+dist = pkg_resources.get_distribution(required)
+if dist is None or not dist.location.startswith("%{_prefix}"):
+    sys.exit(1)
+END
+# run built-in test suite
+python3 test_requests.py
 
 %files
 %defattr(-,root,root)
 %doc HISTORY.rst LICENSE NOTICE README.rst
 %{python3_sitelib}/requests/
-%{python3_sitelib}/requests-*
+%{python3_sitelib}/requests-*.egg-info
 
 %changelog

++++++ PACKAGING_NOTES ++++++
Requests is a tricky package.

The unbundling of urllib3 is unsupported by upstream; AFAICT, mostly because
people are being unreasonable and *third-party packages* expect the bundled
urllib3 to exist. And requests upstream wants to support that usecase.

Therefore, extra care must be taken with the unbundling.

First, upstream also recognizes that we distributors will unbundle, and
actually include a helpful shim in requests/packages/__init__.py. This is to
make sure that importing `requests.packages.urllib3` works even if it is
unbundled, and also that you will get the identical import (unlike if we
installed symlinks, in which case Python would consider `r.p.urrlib3` and
`urllib3` to be different packages. See the file __init__.py for more
information.

We want to keep the shim, so we must install requests/packages/__init__.py
even though we don't install the subdirectories.

Second, it is our job to set requirements in the egg-info properly, so that
users of virtualenvs get the right thing in certain unusual configurations.

Third, requests are at times sensitive to version of urllib3. Historically,
requests even bundled pre-release versions. This will probably not happen
again, but it does mean that we must express requirements for a certain
version of urllib3. I have taken some pains to make the build fail if the
right version of urllib3 is not present. Make sure that urllib3 is updated
first, and run `set_urllib3_version.sh` to update the definition in the spec
file.
++++++ no-default-cacert.patch ++++++
--- /var/tmp/diff_new_pack.ANF4aC/_old  2016-03-26 15:08:27.000000000 +0100
+++ /var/tmp/diff_new_pack.ANF4aC/_new  2016-03-26 15:08:27.000000000 +0100
@@ -1,22 +1,39 @@
---- a/MANIFEST.in
-+++ b/MANIFEST.in
+Index: requests-2.9.1/MANIFEST.in
+===================================================================
+--- requests-2.9.1.orig/MANIFEST.in
++++ requests-2.9.1/MANIFEST.in
 @@ -1 +1 @@
 -include README.rst LICENSE NOTICE HISTORY.rst test_requests.py 
requirements.txt requests/cacert.pem
 +include README.rst LICENSE NOTICE HISTORY.rst test_requests.py 
requirements.txt
---- a/requests/adapters.py
-+++ b/requests/adapters.py
-@@ -182,9 +182,6 @@ class HTTPAdapter(BaseAdapter):
-             if not cert_loc:
-                 cert_loc = DEFAULT_CA_BUNDLE_PATH
+Index: requests-2.9.1/requests/adapters.py
+===================================================================
+--- requests-2.9.1.orig/requests/adapters.py
++++ requests-2.9.1/requests/adapters.py
+@@ -179,15 +179,13 @@ class HTTPAdapter(BaseAdapter):
+             if verify is not True:
+                 cert_loc = verify
  
 -            if not cert_loc:
+-                cert_loc = DEFAULT_CA_BUNDLE_PATH
+-
+-            if not cert_loc:
 -                raise Exception("Could not find a suitable SSL CA certificate 
bundle.")
 -
              conn.cert_reqs = 'CERT_REQUIRED'
  
-             if not os.path.isdir(cert_loc):
---- a/requests/certs.py
-+++ b/requests/certs.py
+-            if not os.path.isdir(cert_loc):
++            if cert_loc is None:
++                # use default context
++                conn.ca_certs = None
++                conn.ca_cert_dir = None
++            elif not os.path.isdir(cert_loc):
+                 conn.ca_certs = cert_loc
+             else:
+                 conn.ca_cert_dir = cert_loc
+Index: requests-2.9.1/requests/certs.py
+===================================================================
+--- requests-2.9.1.orig/requests/certs.py
++++ requests-2.9.1/requests/certs.py
 @@ -18,8 +18,9 @@ try:
  except ImportError:
      def where():
@@ -29,3 +46,16 @@
  
  if __name__ == '__main__':
      print(where())
+Index: requests-2.9.1/setup.py
+===================================================================
+--- requests-2.9.1.orig/setup.py
++++ requests-2.9.1/setup.py
+@@ -50,7 +50,7 @@ setup(
+     author_email='m...@kennethreitz.com',
+     url='http://python-requests.org',
+     packages=packages,
+-    package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},
++    package_data={'': ['LICENSE', 'NOTICE']},
+     package_dir={'requests': 'requests'},
+     include_package_data=True,
+     install_requires=requires,

++++++ requests-do-not-use-bundle.patch ++++++
--- /var/tmp/diff_new_pack.ANF4aC/_old  2016-03-26 15:08:27.000000000 +0100
+++ /var/tmp/diff_new_pack.ANF4aC/_new  2016-03-26 15:08:27.000000000 +0100
@@ -1,113 +1,39 @@
---- a/requests/adapters.py
-+++ b/requests/adapters.py
-@@ -11,25 +11,25 @@ and maintain connections.
- import socket
- 
- from .models import Response
--from .packages.urllib3.poolmanager import PoolManager, proxy_from_url
--from .packages.urllib3.response import HTTPResponse
--from .packages.urllib3.util import Timeout as TimeoutSauce
--from .packages.urllib3.util.retry import Retry
-+from urllib3.poolmanager import PoolManager, proxy_from_url
-+from urllib3.response import HTTPResponse
-+from urllib3.util import Timeout as TimeoutSauce
-+from urllib3.util.retry import Retry
- from .compat import urlparse, basestring
- from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers,
-                     prepend_scheme_if_needed, get_auth_from_url, 
urldefragauth,
-                     select_proxy)
- from .structures import CaseInsensitiveDict
--from .packages.urllib3.exceptions import ClosedPoolError
--from .packages.urllib3.exceptions import ConnectTimeoutError
--from .packages.urllib3.exceptions import HTTPError as _HTTPError
--from .packages.urllib3.exceptions import MaxRetryError
--from .packages.urllib3.exceptions import NewConnectionError
--from .packages.urllib3.exceptions import ProxyError as _ProxyError
--from .packages.urllib3.exceptions import ProtocolError
--from .packages.urllib3.exceptions import ReadTimeoutError
--from .packages.urllib3.exceptions import SSLError as _SSLError
--from .packages.urllib3.exceptions import ResponseError
-+from urllib3.exceptions import ClosedPoolError
-+from urllib3.exceptions import ConnectTimeoutError
-+from urllib3.exceptions import HTTPError as _HTTPError
-+from urllib3.exceptions import MaxRetryError
-+from urllib3.exceptions import NewConnectionError
-+from urllib3.exceptions import ProxyError as _ProxyError
-+from urllib3.exceptions import ProtocolError
-+from urllib3.exceptions import ReadTimeoutError
-+from urllib3.exceptions import SSLError as _SSLError
-+from urllib3.exceptions import ResponseError
- from .cookies import extract_cookies_to_jar
- from .exceptions import (ConnectionError, ConnectTimeout, ReadTimeout, 
SSLError,
-                          ProxyError, RetryError)
---- a/requests/compat.py
-+++ b/requests/compat.py
-@@ -4,8 +4,7 @@
- pythoncompat
- """
- 
--from .packages import chardet
--
-+import chardet
- import sys
- 
- # -------
-@@ -39,7 +38,7 @@ if is_py2:
-     import cookielib
-     from Cookie import Morsel
-     from StringIO import StringIO
--    from .packages.urllib3.packages.ordered_dict import OrderedDict
-+    from urllib3.packages.ordered_dict import OrderedDict
- 
-     builtin_str = str
-     bytes = str
---- a/requests/exceptions.py
-+++ b/requests/exceptions.py
-@@ -7,7 +7,7 @@ requests.exceptions
- This module contains the set of Requests' exceptions.
- 
- """
--from .packages.urllib3.exceptions import HTTPError as BaseHTTPError
-+from urllib3.exceptions import HTTPError as BaseHTTPError
- 
- 
- class RequestException(IOError):
---- a/requests/__init__.py
-+++ b/requests/__init__.py
-@@ -50,7 +50,7 @@ __copyright__ = 'Copyright 2015 Kenneth
- 
- # Attempt to enable urllib3's SNI support, if possible
- try:
--    from .packages.urllib3.contrib import pyopenssl
-+    from urllib3.contrib import pyopenssl
-     pyopenssl.inject_into_urllib3()
- except ImportError:
-     pass
---- a/requests/models.py
-+++ b/requests/models.py
-@@ -16,10 +16,10 @@ from .structures import CaseInsensitiveD
- 
- from .auth import HTTPBasicAuth
- from .cookies import cookiejar_from_dict, get_cookie_header, _copy_cookie_jar
--from .packages.urllib3.fields import RequestField
--from .packages.urllib3.filepost import encode_multipart_formdata
--from .packages.urllib3.util import parse_url
--from .packages.urllib3.exceptions import (
-+from urllib3.fields import RequestField
-+from urllib3.filepost import encode_multipart_formdata
-+from urllib3.util import parse_url
-+from urllib3.exceptions import (
-     DecodeError, ReadTimeoutError, ProtocolError, LocationParseError)
- from .exceptions import (
-     HTTPError, MissingSchema, InvalidURL, ChunkedEncodingError,
---- a/requests/sessions.py
-+++ b/requests/sessions.py
-@@ -21,7 +21,7 @@ from .hooks import default_hooks, dispat
- from .utils import to_key_val_list, default_headers, to_native_string
- from .exceptions import (
-     TooManyRedirects, InvalidSchema, ChunkedEncodingError, 
ContentDecodingError)
--from .packages.urllib3._collections import RecentlyUsedContainer
-+from urllib3._collections import RecentlyUsedContainer
- from .structures import CaseInsensitiveDict
- 
- from .adapters import HTTPAdapter
+Index: requests-2.9.1/requirements.txt
+===================================================================
+--- requests-2.9.1.orig/requirements.txt
++++ requests-2.9.1/requirements.txt
+@@ -4,3 +4,4 @@ pytest-cov==2.1.0
+ pytest-httpbin==0.0.7
+ httpbin==0.4.0
+ wheel
++chardet
+Index: requests-2.9.1/setup.py
+===================================================================
+--- requests-2.9.1.orig/setup.py
++++ requests-2.9.1/setup.py
+@@ -18,15 +18,9 @@ if sys.argv[-1] == 'publish':
+ packages = [
+     'requests',
+     'requests.packages',
+-    'requests.packages.chardet',
+-    'requests.packages.urllib3',
+-    'requests.packages.urllib3.packages',
+-    'requests.packages.urllib3.contrib',
+-    'requests.packages.urllib3.util',
+-    'requests.packages.urllib3.packages.ssl_match_hostname',
+ ]
+ 
+-requires = []
++requires = ['chardet', 'urllib3 >= #URLLIB3VERSION#']
+ 
+ version = ''
+ with open('requests/__init__.py', 'r') as fd:
+@@ -52,7 +46,7 @@ setup(
+     packages=packages,
+     package_data={'': ['LICENSE', 'NOTICE']},
+     package_dir={'requests': 'requests'},
+-    include_package_data=True,
++    include_package_data=False,
+     install_requires=requires,
+     license='Apache 2.0',
+     zip_safe=False,

++++++ set_urllib3_version.sh ++++++
#!/bin/bash

wd=$PWD
tmpdir=`mktemp -d`
cd $tmpdir
tar xzf $wd/requests-*.tar.gz
cd requests-*
version=`python3 -c 'from requests.packages.urllib3 import __version__; 
print(__version__, end="")'`
cd ../..
rm -rf $tmpdir
cd $wd
sed -i 's/%define urllib3_version .*$/%define urllib3_version '"$version"'/' 
python3-requests.spec

Reply via email to