From 0601b7f8eb1a8cea3dffa12e70b4dd347600a2072f9afd2bd5745285b9b73485 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 19 Jan 2020 19:12:15 +0000 Subject: [PATCH] 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 --- ...sles-disable-verification-by-default.patch | 39 +++++++++---------- python-base.spec | 2 +- python.spec | 2 +- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/python-2.7.9-sles-disable-verification-by-default.patch b/python-2.7.9-sles-disable-verification-by-default.patch index 8a77f73..1dbea20 100644 --- a/python-2.7.9-sles-disable-verification-by-default.patch +++ b/python-2.7.9-sles-disable-verification-by-default.patch @@ -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. diff --git a/python-base.spec b/python-base.spec index e066d18..5df39a1 100644 --- a/python-base.spec +++ b/python-base.spec @@ -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 diff --git a/python.spec b/python.spec index 0f4d0f9..859d705 100644 --- a/python.spec +++ b/python.spec @@ -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