From a21d8565dded5f8bf29295b8b18da9c907bd0a59e7c63321d253ca111e449dd6 Mon Sep 17 00:00:00 2001 From: James Oakley Date: Fri, 18 May 2012 01:36:28 +0000 Subject: [PATCH 1/4] - Update to 0.12.1 * New Response.json property * Ability to add string file uploads * Fix out-of-range issue with iter_lines * Fix iter_content default size * Fix POST redirects containing files - 0.12.0 (2012-05-02) * EXPERIMENTAL OAUTH SUPPORT! * Proper CookieJar-backed cookies interface with awesome dict-like interface. * Speed fix for non-iterated content chunks. * Move pre_request to a more usable place. * New pre_send hook. * Lazily encode data, params, files * Load system Certificate Bundle if certify isn't available. * Cleanups, fixes. - Add python-chardet and python-oauthlib requirements - Run test suite (added python-distribute build requirement to enable) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests?expand=0&rev=17 --- python-requests.changes | 21 +++++++++++++++++++++ python-requests.spec | 10 +++++++++- requests-0.11.2.tar.gz | 3 --- requests-0.12.1.tar.gz | 3 +++ 4 files changed, 33 insertions(+), 4 deletions(-) delete mode 100644 requests-0.11.2.tar.gz create mode 100644 requests-0.12.1.tar.gz diff --git a/python-requests.changes b/python-requests.changes index c28b936..2fa3b55 100644 --- a/python-requests.changes +++ b/python-requests.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Fri May 18 00:41:52 UTC 2012 - jfunk@funktronics.ca + +- Update to 0.12.1 + * New Response.json property + * Ability to add string file uploads + * Fix out-of-range issue with iter_lines + * Fix iter_content default size + * Fix POST redirects containing files +- 0.12.0 (2012-05-02) + * EXPERIMENTAL OAUTH SUPPORT! + * Proper CookieJar-backed cookies interface with awesome dict-like interface. + * Speed fix for non-iterated content chunks. + * Move pre_request to a more usable place. + * New pre_send hook. + * Lazily encode data, params, files + * Load system Certificate Bundle if certify isn't available. + * Cleanups, fixes. +- Add python-chardet and python-oauthlib requirements +- Run test suite (added python-distribute build requirement to enable) + ------------------------------------------------------------------- Fri Apr 27 22:57:43 UTC 2012 - jfunk@funktronics.ca diff --git a/python-requests.spec b/python-requests.spec index 0a5ffc7..9ec3b5f 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -18,7 +18,7 @@ Name: python-requests -Version: 0.11.2 +Version: 0.12.1 Release: 0 Url: http://python-requests.org Summary: Awesome Python HTTP Library That's Actually Usable @@ -28,8 +28,13 @@ Source: http://pypi.python.org/packages/source/r/requests/requests-%{ver BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python BuildRequires: python-devel +BuildRequires: python-distribute +BuildRequires: python-chardet +BuildRequires: python-oauthlib Requires: python Requires: python-certifi +Requires: python-chardet +Requires: python-oauthlib %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else @@ -66,6 +71,9 @@ Features: %build python setup.py build +%check +python setup.py test + %install python setup.py install --prefix=%{_prefix} --root=%{buildroot} diff --git a/requests-0.11.2.tar.gz b/requests-0.11.2.tar.gz deleted file mode 100644 index 419def4..0000000 --- a/requests-0.11.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:547bf78a774a6018271d6e5c40613ec554642ba4d6cdf45813e7894145293c57 -size 71080 diff --git a/requests-0.12.1.tar.gz b/requests-0.12.1.tar.gz new file mode 100644 index 0000000..1fb918c --- /dev/null +++ b/requests-0.12.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ce56b87180c06728d96ca734055675abf8f5cc3136e0d7712a6260430685589 +size 78245 From 83bc7fa8f878d71fc9166a71d6905d5280436b834552a11c69a742706e417112 Mon Sep 17 00:00:00 2001 From: James Oakley Date: Sun, 20 May 2012 17:46:42 +0000 Subject: [PATCH 2/4] - Load directory-based cert store in openSUSE >= 12.2 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests?expand=0&rev=18 --- python-requests.changes | 5 +++ python-requests.spec | 10 +++++- requests-use_directory_cert_store.patch | 44 +++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 requests-use_directory_cert_store.patch diff --git a/python-requests.changes b/python-requests.changes index 2fa3b55..e42c6f7 100644 --- a/python-requests.changes +++ b/python-requests.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun May 20 17:44:57 UTC 2012 - jfunk@funktronics.ca + +- Load directory-based cert store in openSUSE >= 12.2 + ------------------------------------------------------------------- Fri May 18 00:41:52 UTC 2012 - jfunk@funktronics.ca diff --git a/python-requests.spec b/python-requests.spec index 9ec3b5f..3636843 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -25,6 +25,8 @@ Summary: Awesome Python HTTP Library That's Actually Usable License: ISC Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz +# PATCH-FIX-OPENSUSE requests-use_directory_cert_store.patch [bnc#761501] -- Load directory-based cert store in /etc/ssl/certs. Depends on Python patched to allow it +Patch0: requests-use_directory_cert_store.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python BuildRequires: python-devel @@ -32,9 +34,12 @@ BuildRequires: python-distribute BuildRequires: python-chardet BuildRequires: python-oauthlib Requires: python -Requires: python-certifi Requires: python-chardet Requires: python-oauthlib +%if 0%{?suse_version} && 0%{?suse_version} < 1220 +BuildRequires: python-certifi +Requires: python-certifi +%endif %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else @@ -67,6 +72,9 @@ Features: %prep %setup -q -n requests-%{version} +%if 0%{?suse_version} && 0%{?suse_version} < 1220 +%patch0 -p1 +%endif %build python setup.py build diff --git a/requests-use_directory_cert_store.patch b/requests-use_directory_cert_store.patch new file mode 100644 index 0000000..3dcf2d9 --- /dev/null +++ b/requests-use_directory_cert_store.patch @@ -0,0 +1,44 @@ +Index: requests-0.12.1/requests/utils.py +=================================================================== +--- requests-0.12.1.orig/requests/utils.py ++++ requests-0.12.1/requests/utils.py +@@ -14,6 +14,9 @@ import codecs + import os + import random + import re ++import socket ++import ssl ++import _ssl + import zlib + from netrc import netrc, NetrcParseError + +@@ -51,9 +54,13 @@ def get_os_ca_bundle_path(): + return path + return None + +-# if certifi is installed, use its CA bundle; +-# otherwise, try and use the OS bundle +-DEFAULT_CA_BUNDLE_PATH = CERTIFI_BUNDLE_PATH or get_os_ca_bundle_path() ++# If SSL module can load a directory-based store, use that ++try: ++ _ssl.sslwrap(socket.socket()._sock, False, None, None, ssl.CERT_REQUIRED, ssl.PROTOCOL_SSLv23, "/etc/ssl/certs", None) ++except ssl.SSLError: ++ # if certifi is installed, use its CA bundle; ++ # otherwise, try and use the OS bundle ++ DEFAULT_CA_BUNDLE_PATH = CERTIFI_BUNDLE_PATH or get_os_ca_bundle_path() + + def dict_to_sequence(d): + """Returns an internal sequence dictionary update.""" +Index: requests-0.12.1/setup.py +=================================================================== +--- requests-0.12.1.orig/setup.py ++++ requests-0.12.1/setup.py +@@ -34,7 +34,7 @@ packages = [ + # On certain supported platforms (e.g., Red Hat / Debian / FreeBSD), Requests can + # use the system CA bundle instead; see `requests.utils` for details. + # If your platform is supported, set `requires` to [] instead: +-requires = ['certifi>=0.0.7'] ++requires = [] + + # chardet is used to optimally guess the encodings of pages that don't declare one. + # At this time, chardet is not a required dependency. However, it's sufficiently From d22ba905da7e2188b39c808a9fafa73c56d3de5a4f77401914fd454bb36f9088 Mon Sep 17 00:00:00 2001 From: James Oakley Date: Sun, 20 May 2012 17:57:04 +0000 Subject: [PATCH 3/4] Fix issues with last checkin OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests?expand=0&rev=19 --- python-requests.spec | 2 +- requests-use_directory_cert_store.patch | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python-requests.spec b/python-requests.spec index 3636843..94ff61c 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -72,7 +72,7 @@ Features: %prep %setup -q -n requests-%{version} -%if 0%{?suse_version} && 0%{?suse_version} < 1220 +%if 0%{?suse_version} && 0%{?suse_version} >= 1220 %patch0 -p1 %endif diff --git a/requests-use_directory_cert_store.patch b/requests-use_directory_cert_store.patch index 3dcf2d9..fedc7e9 100644 --- a/requests-use_directory_cert_store.patch +++ b/requests-use_directory_cert_store.patch @@ -12,7 +12,7 @@ Index: requests-0.12.1/requests/utils.py import zlib from netrc import netrc, NetrcParseError -@@ -51,9 +54,13 @@ def get_os_ca_bundle_path(): +@@ -51,9 +54,14 @@ def get_os_ca_bundle_path(): return path return None @@ -22,6 +22,7 @@ Index: requests-0.12.1/requests/utils.py +# If SSL module can load a directory-based store, use that +try: + _ssl.sslwrap(socket.socket()._sock, False, None, None, ssl.CERT_REQUIRED, ssl.PROTOCOL_SSLv23, "/etc/ssl/certs", None) ++ DEFAULT_CA_BUNDLE_PATH = "/etc/ssl/certs" +except ssl.SSLError: + # if certifi is installed, use its CA bundle; + # otherwise, try and use the OS bundle From 46275a5a11d7557e125ec5aa4fa0c36ed5a26dc3a1500beebc9ce32024c806fa Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Wed, 23 May 2012 12:16:00 +0000 Subject: [PATCH 4/4] - Use a slightly different approach for bnc#761500, try to use /etc/ssl/certs but use /etc/ssl/ca-bundle.pem as a fallback. The previous fix didn't work for me as (my) Python ssl module doesn't support cert directories... - No need to check SUSE versions for python-certifi, it only is/was part of openSUSE:Factory for a brief period of time OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-requests?expand=0&rev=20 --- python-requests.changes | 9 +++++ python-requests.spec | 13 ++---- requests-suse_cert_paths.patch | 54 +++++++++++++++++++++++++ requests-use_directory_cert_store.patch | 45 --------------------- 4 files changed, 66 insertions(+), 55 deletions(-) create mode 100644 requests-suse_cert_paths.patch delete mode 100644 requests-use_directory_cert_store.patch diff --git a/python-requests.changes b/python-requests.changes index e42c6f7..1f5b2ba 100644 --- a/python-requests.changes +++ b/python-requests.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed May 23 12:09:35 UTC 2012 - saschpe@suse.de + +- Use a slightly different approach for bnc#761500, try to use /etc/ssl/certs + but use /etc/ssl/ca-bundle.pem as a fallback. The previous fix didn't work + for me as (my) Python ssl module doesn't support cert directories... +- No need to check SUSE versions for python-certifi, it only is/was + part of openSUSE:Factory for a brief period of time + ------------------------------------------------------------------- Sun May 20 17:44:57 UTC 2012 - jfunk@funktronics.ca diff --git a/python-requests.spec b/python-requests.spec index 94ff61c..7b4769e 100644 --- a/python-requests.spec +++ b/python-requests.spec @@ -16,7 +16,6 @@ # - Name: python-requests Version: 0.12.1 Release: 0 @@ -25,21 +24,17 @@ Summary: Awesome Python HTTP Library That's Actually Usable License: ISC Group: Development/Languages/Python Source: http://pypi.python.org/packages/source/r/requests/requests-%{version}.tar.gz -# PATCH-FIX-OPENSUSE requests-use_directory_cert_store.patch [bnc#761501] -- Load directory-based cert store in /etc/ssl/certs. Depends on Python patched to allow it -Patch0: requests-use_directory_cert_store.patch +# PATCH-FIX-UPSREAM requests-suse_cert_paths.patch [bnc#761501] -- Load directory-based cert store in /etc/ssl/certs. Depends on Python patched to allow it, fall back to /etc/ssl/ca-bundle.pem otherwise +Patch0: requests-suse_cert_paths.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: python +BuildRequires: python-chardet BuildRequires: python-devel BuildRequires: python-distribute -BuildRequires: python-chardet BuildRequires: python-oauthlib Requires: python Requires: python-chardet Requires: python-oauthlib -%if 0%{?suse_version} && 0%{?suse_version} < 1220 -BuildRequires: python-certifi -Requires: python-certifi -%endif %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else @@ -72,9 +67,7 @@ Features: %prep %setup -q -n requests-%{version} -%if 0%{?suse_version} && 0%{?suse_version} >= 1220 %patch0 -p1 -%endif %build python setup.py build diff --git a/requests-suse_cert_paths.patch b/requests-suse_cert_paths.patch new file mode 100644 index 0000000..0959726 --- /dev/null +++ b/requests-suse_cert_paths.patch @@ -0,0 +1,54 @@ +diff -ru a/requests/utils.py b/requests/utils.py +--- a/requests/utils.py 2012-05-08 06:56:28.000000000 +0200 ++++ b/requests/utils.py 2012-05-23 14:06:43.728477504 +0200 +@@ -14,6 +14,9 @@ + import os + import random + import re ++import socket ++import ssl ++import _ssl + import zlib + from netrc import netrc, NetrcParseError + +@@ -42,13 +45,26 @@ + '/etc/ssl/certs/ca-certificates.crt', + # FreeBSD (provided by the ca_root_nss package): + '/usr/local/share/certs/ca-root-nss.crt', ++ # openSUSE (provided by the ca-certificates package), the 'certs' directory is the ++ # preferred way but may not be supported by the SSL module, thus it has 'ca-bundle.pem' ++ # as a fallback (which is generated from pem files in the 'certs' directory): ++ '/etc/ssl/certs', ++ '/etc/ssl/ca-bundle.pem', + ] + + def get_os_ca_bundle_path(): + """Try to pick an available CA certificate bundle provided by the OS.""" + for path in POSSIBLE_CA_BUNDLE_PATHS: + if os.path.exists(path): +- return path ++ if os.path.isdir(path): ++ try: ++ # Current candidate is a directory, check if SSL module supports that ++ _ssl.sslwrap(socket.socket()._sock, False, None, None, ssl.CERT_REQUIRED, ssl.PROTOCOL_SSLv23, path, None) ++ return path ++ except: ++ pass # No support, let's check the next candidate ++ else: ++ return path + return None + + # if certifi is installed, use its CA bundle; +Only in b/requests: .utils.py.swp +diff -ru a/setup.py b/setup.py +--- a/setup.py 2012-05-08 06:56:28.000000000 +0200 ++++ b/setup.py 2012-05-23 14:07:30.303478614 +0200 +@@ -34,7 +34,7 @@ + # On certain supported platforms (e.g., Red Hat / Debian / FreeBSD), Requests can + # use the system CA bundle instead; see `requests.utils` for details. + # If your platform is supported, set `requires` to [] instead: +-requires = ['certifi>=0.0.7'] ++requires = [] + + # chardet is used to optimally guess the encodings of pages that don't declare one. + # At this time, chardet is not a required dependency. However, it's sufficiently diff --git a/requests-use_directory_cert_store.patch b/requests-use_directory_cert_store.patch deleted file mode 100644 index fedc7e9..0000000 --- a/requests-use_directory_cert_store.patch +++ /dev/null @@ -1,45 +0,0 @@ -Index: requests-0.12.1/requests/utils.py -=================================================================== ---- requests-0.12.1.orig/requests/utils.py -+++ requests-0.12.1/requests/utils.py -@@ -14,6 +14,9 @@ import codecs - import os - import random - import re -+import socket -+import ssl -+import _ssl - import zlib - from netrc import netrc, NetrcParseError - -@@ -51,9 +54,14 @@ def get_os_ca_bundle_path(): - return path - return None - --# if certifi is installed, use its CA bundle; --# otherwise, try and use the OS bundle --DEFAULT_CA_BUNDLE_PATH = CERTIFI_BUNDLE_PATH or get_os_ca_bundle_path() -+# If SSL module can load a directory-based store, use that -+try: -+ _ssl.sslwrap(socket.socket()._sock, False, None, None, ssl.CERT_REQUIRED, ssl.PROTOCOL_SSLv23, "/etc/ssl/certs", None) -+ DEFAULT_CA_BUNDLE_PATH = "/etc/ssl/certs" -+except ssl.SSLError: -+ # if certifi is installed, use its CA bundle; -+ # otherwise, try and use the OS bundle -+ DEFAULT_CA_BUNDLE_PATH = CERTIFI_BUNDLE_PATH or get_os_ca_bundle_path() - - def dict_to_sequence(d): - """Returns an internal sequence dictionary update.""" -Index: requests-0.12.1/setup.py -=================================================================== ---- requests-0.12.1.orig/setup.py -+++ requests-0.12.1/setup.py -@@ -34,7 +34,7 @@ packages = [ - # On certain supported platforms (e.g., Red Hat / Debian / FreeBSD), Requests can - # use the system CA bundle instead; see `requests.utils` for details. - # If your platform is supported, set `requires` to [] instead: --requires = ['certifi>=0.0.7'] -+requires = [] - - # chardet is used to optimally guess the encodings of pages that don't declare one. - # At this time, chardet is not a required dependency. However, it's sufficiently