From 5e4e44a2544e89d5ec2357b6acb7ede57c6e0f56 Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Sat, 22 Jul 2023 20:39:04 +0300 Subject: [PATCH 1/4] Drop a fallback to using SecureTransport on macOS --- src/pip/_internal/__init__.py | 1 - .../_internal/utils/inject_securetransport.py | 35 ------------------- tools/news/12175.removal.rst | 1 + 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/pip/_internal/utils/inject_securetransport.py create mode 100644 tools/news/12175.removal.rst diff --git a/src/pip/_internal/__init__.py b/src/pip/_internal/__init__.py index 6afb5c627ce..96c6b88c112 100755 --- a/src/pip/_internal/__init__.py +++ b/src/pip/_internal/__init__.py @@ -1,6 +1,5 @@ from typing import List, Optional -import pip._internal.utils.inject_securetransport # noqa from pip._internal.utils import _log # init_logging() must be called before any call to logging.getLogger() diff --git a/src/pip/_internal/utils/inject_securetransport.py b/src/pip/_internal/utils/inject_securetransport.py deleted file mode 100644 index 276aa79bb81..00000000000 --- a/src/pip/_internal/utils/inject_securetransport.py +++ /dev/null @@ -1,35 +0,0 @@ -"""A helper module that injects SecureTransport, on import. - -The import should be done as early as possible, to ensure all requests and -sessions (or whatever) are created after injecting SecureTransport. - -Note that we only do the injection on macOS, when the linked OpenSSL is too -old to handle TLSv1.2. -""" - -import sys - - -def inject_securetransport() -> None: - # Only relevant on macOS - if sys.platform != "darwin": - return - - try: - import ssl - except ImportError: - return - - # Checks for OpenSSL 1.0.1 - if ssl.OPENSSL_VERSION_NUMBER >= 0x1000100F: - return - - try: - from pip._vendor.urllib3.contrib import securetransport - except (ImportError, OSError): - return - - securetransport.inject_into_urllib3() - - -inject_securetransport() diff --git a/tools/news/12175.removal.rst b/tools/news/12175.removal.rst new file mode 100644 index 00000000000..10ac142de48 --- /dev/null +++ b/tools/news/12175.removal.rst @@ -0,0 +1 @@ +Drop a fallback to using SecureTransport on macOS as it is not needed anymore. \ No newline at end of file From 86704d57e246ae5a84d3545df30d04ed5a908e56 Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Sat, 22 Jul 2023 20:53:16 +0300 Subject: [PATCH 2/4] Move the news entry to the right directory --- {tools/news => news}/12175.removal.rst | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {tools/news => news}/12175.removal.rst (100%) diff --git a/tools/news/12175.removal.rst b/news/12175.removal.rst similarity index 100% rename from tools/news/12175.removal.rst rename to news/12175.removal.rst From 2a23ce94749de92405edca234618845056da0b51 Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Sat, 22 Jul 2023 20:57:04 +0300 Subject: [PATCH 3/4] Fix ending of the news entry --- news/12175.removal.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/12175.removal.rst b/news/12175.removal.rst index 10ac142de48..16e5bb02a07 100644 --- a/news/12175.removal.rst +++ b/news/12175.removal.rst @@ -1 +1 @@ -Drop a fallback to using SecureTransport on macOS as it is not needed anymore. \ No newline at end of file +Drop a fallback to using SecureTransport on macOS as it is not needed anymore. From 765732df4fb0be1fe1046bc9c2d0604c34304b53 Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Mon, 24 Jul 2023 18:51:02 +0300 Subject: [PATCH 4/4] Update the news entry --- news/12175.removal.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/12175.removal.rst b/news/12175.removal.rst index 16e5bb02a07..bf3500f351a 100644 --- a/news/12175.removal.rst +++ b/news/12175.removal.rst @@ -1 +1 @@ -Drop a fallback to using SecureTransport on macOS as it is not needed anymore. +Drop a fallback to using SecureTransport on macOS. It was useful when pip detected OpenSSL older than 1.0.1, but the current pip does not support any Python version supporting such old OpenSSL versions.