Update from application of this repo to SLE-12

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python?expand=0&rev=271
This commit is contained in:
Matej Cepl 2020-01-19 19:12:15 +00:00 committed by Git OBS Bridge
parent af1a7b545a
commit 0601b7f8eb
3 changed files with 20 additions and 23 deletions

View File

@ -1,24 +1,21 @@
Index: Python-2.7.9/Lib/ssl.py
===================================================================
--- Python-2.7.9.orig/Lib/ssl.py 2015-08-12 15:53:27.419729448 +0200
+++ Python-2.7.9/Lib/ssl.py 2015-08-12 15:58:10.668465183 +0200
@@ -469,7 +469,18 @@
return context
# Used by http.client if no context is explicitly passed.
-_create_default_https_context = create_default_context
+try:
+ # load the TLS checks policy from separate package
+ import sle_tls_checks_policy as policy
+ if policy.get_policy:
+ _create_default_https_context = policy.get_policy()
+ else:
+ # empty policy file means simply enable strict verification
+ _create_default_https_context = create_default_context
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -495,7 +495,17 @@ def _get_https_context_factory():
config_setting = os.environ.get(_https_verify_envvar)
if config_setting == '0':
return _create_unverified_context
- return create_default_context
+
+except ImportError:
+ # policy not present, disable verification for backwards compatibility
+ _create_default_https_context = _create_unverified_context
+ try:
+ # load the TLS checks policy from separate package
+ import sle_tls_checks_policy as policy
+ if policy.get_policy:
+ return policy.get_policy()
+ else:
+ # empty policy file means simply enable strict verification
+ return create_default_context
+ except ImportError:
+ return create_default_context
_create_default_https_context = _get_https_context_factory()
# Backwards compatibility alias, even though it's not a public name.

View File

@ -88,7 +88,7 @@ Patch56: adapted-from-F00251-change-user-install-location.patch
BuildRequires: automake
BuildRequires: fdupes
BuildRequires: libbz2-devel
%if %{suse_version} > 1200
%if %{suse_version} >= 1500
BuildRequires: libnsl-devel
%endif
BuildRequires: pkg-config

View File

@ -94,7 +94,7 @@ BuildRequires: fdupes
BuildRequires: gdbm-devel
BuildRequires: gmp-devel
BuildRequires: libbz2-devel
%if %{suse_version} > 1200
%if %{suse_version} >= 1500
BuildRequires: libnsl-devel
%endif
BuildRequires: libopenssl-devel