Accepting request 725772 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/725772
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-httplib2?expand=0&rev=43
This commit is contained in:
Dominique Leuenberger 2019-08-27 08:10:16 +00:00 committed by Git OBS Bridge
commit b92b4b7a86
5 changed files with 72 additions and 128 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e404d3b7bd86c1bc931906098e7c1305d6a3a6dcef141b8bb1059903abb3ceeb
size 204500

3
httplib2-0.13.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6901c8c0ffcf721f9ce270ad86da37bc2b4d32b8802d4a9cec38274898a64044
size 219502

View File

@ -1,118 +0,0 @@
diff --git a/python2/httplib2/__init__.py b/python2/httplib2/__init__.py
index 32ec959..cf7f2f9 100644
--- a/python2/httplib2/__init__.py
+++ b/python2/httplib2/__init__.py
@@ -83,11 +83,20 @@ def _ssl_wrap_socket(sock, key_file, cert_file, disable_validation,
cert_reqs = ssl.CERT_NONE
else:
cert_reqs = ssl.CERT_REQUIRED
- if ssl_version is None:
- ssl_version = ssl.PROTOCOL_SSLv23
-
if hasattr(ssl, 'SSLContext'): # Python 2.7.9
- context = ssl.SSLContext(ssl_version)
+ cafile = ca_certs
+ capath = None
+ if cafile is not None and os.path.isdir(cafile):
+ cafile = None
+ capath = ca_certs
+
+ if ssl_version is None:
+ context = ssl.create_default_context(cafile=cafile, capath=capath)
+ if disable_validation:
+ context.check_hostname = False
+ else:
+ context = ssl.SSLContext(ssl_version)
+
context.verify_mode = cert_reqs
context.check_hostname = (cert_reqs != ssl.CERT_NONE)
if cert_file:
@@ -96,6 +105,9 @@ def _ssl_wrap_socket(sock, key_file, cert_file, disable_validation,
context.load_verify_locations(ca_certs)
return context.wrap_socket(sock, server_hostname=hostname)
else:
+ if ssl_version is None:
+ ssl_version = ssl.PROTOCOL_SSLv23
+
return ssl.wrap_socket(sock, keyfile=key_file, certfile=cert_file,
cert_reqs=cert_reqs, ca_certs=ca_certs,
ssl_version=ssl_version)
@@ -210,15 +222,8 @@ class NotRunningAppEngineEnvironment(HttpLib2Error): pass
# requesting that URI again.
DEFAULT_MAX_REDIRECTS = 5
-try:
- # Users can optionally provide a module that tells us where the CA_CERTS
- # are located.
- import ca_certs_locater
- CA_CERTS = ca_certs_locater.get()
-except ImportError:
- # Default CA certificates file bundled with httplib2.
- CA_CERTS = os.path.join(
- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
+# Default CA certificates file bundled with httplib2.
+CA_CERTS = None
# Which headers are hop-by-hop headers by default
HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
@@ -975,8 +980,6 @@ class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
cert_file=cert_file, strict=strict)
self.timeout = timeout
self.proxy_info = proxy_info
- if ca_certs is None:
- ca_certs = CA_CERTS
self.ca_certs = ca_certs
self.disable_ssl_certificate_validation = \
disable_ssl_certificate_validation
diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py
index 0000ed9..40f4556 100644
--- a/python3/httplib2/__init__.py
+++ b/python3/httplib2/__init__.py
@@ -124,8 +124,7 @@ DEFAULT_MAX_REDIRECTS = 5
HOP_BY_HOP = ['connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', 'upgrade']
# Default CA certificates file bundled with httplib2.
-CA_CERTS = os.path.join(
- os.path.dirname(os.path.abspath(__file__ )), "cacerts.txt")
+CA_CERTS = None
def _get_end2end_headers(response):
hopbyhop = list(HOP_BY_HOP)
@@ -838,16 +837,17 @@ class HTTPSConnectionWithTimeout(http.client.HTTPSConnection):
# TODO: implement proxy_info
self.proxy_info = proxy_info
context = None
- if ca_certs is None:
- ca_certs = CA_CERTS
- if (cert_file or ca_certs):
+ if True:
if not hasattr(ssl, 'SSLContext'):
raise CertificateValidationUnsupportedInPython31()
- context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
- if disable_ssl_certificate_validation:
- context.verify_mode = ssl.CERT_NONE
- else:
- context.verify_mode = ssl.CERT_REQUIRED
+
+ cafile = ca_certs
+ capath = None
+ if cafile is not None and os.path.isdir(cafile):
+ cafile = None
+ capath = ca_certs
+
+ context = ssl.create_default_context(cafile=cafile, capath=capath)
if cert_file:
context.load_cert_chain(cert_file, key_file)
if ca_certs:
diff --git a/setup.py b/setup.py
index 9c8c86c..34ea20a 100755
--- a/setup.py
+++ b/setup.py
@@ -61,7 +61,6 @@ A comprehensive HTTP client library, ``httplib2`` supports many features left ou
""",
package_dir=pkgdir,
packages=['httplib2'],
- package_data={'httplib2': ['*.txt']},
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',

View File

@ -1,3 +1,65 @@
-------------------------------------------------------------------
Fri Aug 2 09:41:37 UTC 2019 - pgajdos@suse.com
- version update to 0.13.1
0.13.1
* Python3: Use no_proxy
https://github.com/httplib2/httplib2/pull/140
0.13.0
* Allow setting TLS max/min versions
https://github.com/httplib2/httplib2/pull/138
0.12.3
* No changes to library. Distribute py3 wheels.
0.12.1
* Catch socket timeouts and clear dead connection
https://github.com/httplib2/httplib2/issues/18
https://github.com/httplib2/httplib2/pull/111
* Officially support Python 3.7 (package metadata)
https://github.com/httplib2/httplib2/issues/123
0.12.0
* Drop support for Python 3.3
* ca_certs from environment HTTPLIB2_CA_CERTS or certifi
https://github.com/httplib2/httplib2/pull/117
* PROXY_TYPE_HTTP with non-empty user/pass raised TypeError: bytes required
https://github.com/httplib2/httplib2/pull/115
* Revert http:443->https workaround
https://github.com/httplib2/httplib2/issues/112
* eliminate connection pool read race
https://github.com/httplib2/httplib2/pull/110
* cache: stronger safename
https://github.com/httplib2/httplib2/pull/101
0.11.3
* No changes, just reupload of 0.11.2 after fixing automatic release conditions in Travis.
0.11.2
* proxy: py3 NameError basestring
https://github.com/httplib2/httplib2/pull/100
0.11.1
* Fix HTTP(S)ConnectionWithTimeout AttributeError proxy_info
https://github.com/httplib2/httplib2/pull/97
0.11.0
* Add DigiCert Global Root G2 serial 033af1e6a711a9a0bb2864b11d09fae5
https://github.com/httplib2/httplib2/pull/91
* python3 proxy support
https://github.com/httplib2/httplib2/pull/90
* If no_proxy environment value ends with comma then proxy is not used
https://github.com/httplib2/httplib2/issues/11
* fix UnicodeDecodeError using socks5 proxy
https://github.com/httplib2/httplib2/pull/64
* Respect NO_PROXY env var in proxy_info_from_url
https://github.com/httplib2/httplib2/pull/58
* NO_PROXY=bar was matching foobar (suffix without dot delimiter)
New behavior matches curl/wget:
- no_proxy=foo.bar will only skip proxy for exact hostname match
- no_proxy=.wild.card will skip proxy for any.subdomains.wild.card
https://github.com/httplib2/httplib2/issues/94
* Bugfix for Content-Encoding: deflate
https://stackoverflow.com/a/22311297
- deleted patches
- httplib2-use-system-certs.patch (not needed)
httplib2 started to use certifi and this is already bent to
use system certificate bundle by
python-certifi-shipped-requests-cabundle.patch
-------------------------------------------------------------------
Fri Feb 23 16:31:07 UTC 2018 - snica@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-httplib2
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -21,16 +21,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-httplib2
Version: 0.10.3
Version: 0.13.1
Release: 0
Url: https://github.com/httplib2/httplib2
Summary: A Python HTTP client library
License: MIT AND Apache-2.0 AND (MPL-1.1 OR GPL-2.0+ OR LGPL-2.1+)
License: MIT AND Apache-2.0 AND (MPL-1.1 OR GPL-2.0-or-later OR LGPL-2.1-or-later)
Group: Development/Libraries/Python
Source: https://files.pythonhosted.org/packages/source/h/httplib2/httplib2-%{version}.tar.gz
# PATCH-FIX-OPENSUSE: Don't ship private copy of Mozilla NSS certs, use system certs instead (bnc#761162)
Patch0: httplib2-use-system-certs.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with tests}
# Test requirements (for ssl module):
@ -38,6 +37,7 @@ BuildRequires: python
BuildRequires: python3
%endif
Requires: ca-certificates
Requires: python-certifi
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%python_subpackages
@ -49,13 +49,13 @@ left out of other HTTP libraries.
%prep
%setup -q -n httplib2-%{version}
%patch0 -p1
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%if %{with tests}
%check