Hello community,

here is the log from the commit of package python-requests for openSUSE:Factory 
checked in at 2017-05-16 14:30:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-requests (Old)
 and      /work/SRC/openSUSE:Factory/.python-requests.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-requests"

Tue May 16 14:30:05 2017 rev:41 rq:494948 version:2.13.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-requests/python-requests.changes  
2017-03-24 01:53:04.574757569 +0100
+++ /work/SRC/openSUSE:Factory/.python-requests.new/python-requests.changes     
2017-05-16 14:30:07.217870746 +0200
@@ -1,0 +2,18 @@
+Tue May  2 07:03:13 UTC 2017 - [email protected]
+
+- The following two entries should have been added to the previous
+  changelog entry.
+- Drop urllib3-ssl-default-context.patch
+- Add requests-do-not-use-bundle.patch
+
+-------------------------------------------------------------------
+Tue Mar 14 14:37:56 UTC 2017 - [email protected]
+
+- update for multipython build
+- synchronize with python 3 version
+  * drop urllib3-ssl-default-context.patch
+  * add requests-do-not-use-bundle.patch
+- debundle urllib3 and chardet
+- enable test suite
+
+-------------------------------------------------------------------
@@ -139,0 +158,2 @@
+- update urllib3 requirement to 1.19.1
+- add idna requirement, refresh unbundling patch

Old:
----
  requests-2.13.0.tar.gz
  urllib3-ssl-default-context.patch

New:
----
  PACKAGING_NOTES
  requests-do-not-use-bundle.patch
  set_urllib3_version.sh
  v2.13.0.tar.gz

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

Other differences:
------------------
++++++ python-requests.spec ++++++
--- /var/tmp/diff_new_pack.nNrQcm/_old  2017-05-16 14:30:08.249725788 +0200
+++ /var/tmp/diff_new_pack.nNrQcm/_new  2017-05-16 14:30:08.253725227 +0200
@@ -16,9 +16,8 @@
 #
 
 
-%if 0%{?suse_version} < 1120
-%{!?python_sitelib: %global python_sitelib %(python -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
-%endif
+%define urllib3_version 1.20
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-requests
 Version:        2.13.0
 Release:        0
@@ -26,35 +25,43 @@
 License:        Apache-2.0
 Group:          Development/Languages/Python
 Url:            http://python-requests.org/
-Source:         
https://pypi.io/packages/source/r/requests/requests-%{version}.tar.gz
+#Source:         
https://files.pythonhosted.org/packages/source/r/requests/requests-%{version}.tar.gz
+Source:         
https://github.com/kennethreitz/requests/archive/v%{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-UPSTREAM update urllib3 to do the proper passthrough to 
set_default_verify_paths
-Patch1:         urllib3-ssl-default-context.patch
+# PATCH-FIX-OPENSUSE requests-do-not-use-bundle.patch -- Use system libraries 
instead of bundled ones.
+Patch1:         requests-do-not-use-bundle.patch
+BuildRequires:  %{python_module devel}
+BuildRequires:  %{python_module py}
+BuildRequires:  %{python_module setuptools}
+BuildRequires:  %{python_module urllib3 >= %urllib3_version}
+BuildRequires:  ca-certificates
 BuildRequires:  python
-BuildRequires:  python-devel
-BuildRequires:  python-py
-BuildRequires:  python-setuptools
+BuildRequires:  python-rpm-macros
+# SECTION test requirements
+BuildRequires:  %{python_module PySocks >= 1.5.6}
+BuildRequires:  %{python_module chardet}
+BuildRequires:  %{python_module idna >= 2.2}
+BuildRequires:  %{python_module pytest-httpbin}
+BuildRequires:  %{python_module pytest-mock}
+BuildRequires:  %{python_module pytest}
+# /SECTION
+Requires:       ca-certificates
 Requires:       python
 # for good measure, at least recommend an actual set of certificates
 Recommends:     ca-certificates-mozilla
-Recommends:     python-cryptography >= 1.3.4
-# requirements for pyopenssl fallback of bundled urllib3
-Recommends:     python-ndg-httpsclient
 Recommends:     python-pyOpenSSL >= 0.14
-Recommends:     python-pyasn1
-%if 0%{?suse_version} <= 1200
-BuildRequires:  openssl-certs
-Requires:       openssl-certs
-%else
-BuildRequires:  ca-certificates
-Requires:       ca-certificates
-%endif
-%if 0%{?suse_version} >= 1120
+Recommends:     python-cryptography >= 1.3.4
+Recommends:     python-PySocks >= 1.5.6
+Requires:       python-chardet
+Requires:       python-idna >= 2.2
+Requires:       python-py
+Requires:       python-urllib3 >= %urllib3_version
 BuildArch:      noarch
-%else
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%endif
+
+%python_subpackages
 
 %description
 Requests is an ISC Licensed HTTP library, written in Python, for
@@ -82,23 +89,40 @@
 %prep
 %setup -q -n requests-%{version}
 %patch0 -p1
-pushd requests/packages
 %patch1 -p1
-popd
 rm -f requests/cacert.pem
 
+# fill out required urllib3 version
+sed -i s/#URLLIB3VERSION#/%{urllib3_version}/ setup.py
+echo "urllib3 >= %{urllib3_version}" >> requirements.txt
+# drop shebang from certs.py
+sed -i '1s/^#!.*$//' requests/certs.py
+
 %build
-python setup.py build
+%python_build
 
 %install
-python setup.py install \
-  --root=%{buildroot} --prefix=%{_prefix}
+%python_install
+# check that urllib3 is not installed
+test ! -e %{buildroot}%{python3_sitelib}/requests/packages/urllib3
+
+%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
 
-# Tests require network access.
-# %check
-# python test_requests.py
+# exclude tests connecting to TARPIT
+%python_exec -m pytest tests -k "not (TestTimeout and connect)"
 
-%files
+%files %{python_files}
 %defattr(-,root,root)
 %doc HISTORY.rst LICENSE NOTICE README.rst
 %{python_sitelib}/requests/

++++++ 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.nNrQcm/_old  2017-05-16 14:30:08.309717361 +0200
+++ /var/tmp/diff_new_pack.nNrQcm/_new  2017-05-16 14:30:08.313716799 +0200
@@ -46,3 +46,15 @@
  
  if __name__ == '__main__':
      print(where())
+diff -rupN requests-2.10.0.orig/setup.py requests-2.10.0/setup.py
+--- requests-2.10.0.orig/setup.py      2016-04-29 18:03:18.000000000 -0400
++++ requests-2.10.0/setup.py   2016-06-03 01:17:13.549030517 -0400
+@@ -68,7 +68,7 @@ setup(
+     author_email='[email protected]',
+     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 ++++++
Index: requests-2.13.0/setup.py
===================================================================
--- requests-2.13.0.orig/setup.py
+++ requests-2.13.0/setup.py
@@ -36,17 +36,9 @@ if sys.argv[-1] == 'publish':
 packages = [
     'requests',
     'requests.packages',
-    'requests.packages.chardet',
-    'requests.packages.idna',
-    'requests.packages.urllib3',
-    'requests.packages.urllib3.packages',
-    'requests.packages.urllib3.contrib',
-    'requests.packages.urllib3.util',
-    'requests.packages.urllib3.packages.ssl_match_hostname',
-    'requests.packages.urllib3.packages.backports',
 ]
 
-requires = []
+requires = ['chardet', 'idna', 'urllib3 >= #URLLIB3VERSION#']
 test_requirements = ['pytest>=2.8.0', 'pytest-httpbin==0.0.7', 'pytest-cov', 
'pytest-mock']
 
 with open('requests/__init__.py', 'r') as fd:
@@ -72,7 +64,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"'/' 
python-requests.spec

Reply via email to