diff setup.py @ 52317:5d81f4b7e024

setup_py: simplify ssl check
author paugier <pierre.augier@univ-grenoble-alpes.fr>
date Sat, 23 Nov 2024 05:50:43 +0100
parents 24abb1489089
children 7606466300c1
line wrap: on
line diff
--- a/setup.py	Thu Oct 24 00:38:01 2024 +0200
+++ b/setup.py	Sat Nov 23 05:50:43 2024 +0100
@@ -18,16 +18,7 @@
 
 import ssl
 
-# ssl.HAS_TLSv1* are preferred to check support but they were added in Python
-# 3.7. Prior to CPython commit 6e8cda91d92da72800d891b2fc2073ecbc134d98
-# (backported to the 3.7 branch), ssl.PROTOCOL_TLSv1_1 / ssl.PROTOCOL_TLSv1_2
-# were defined only if compiled against a OpenSSL version with TLS 1.1 / 1.2
-# support. At the mentioned commit, they were unconditionally defined.
-_notset = object()
-has_tlsv1_2 = getattr(ssl, 'HAS_TLSv1_2', _notset)
-if has_tlsv1_2 is _notset:
-    has_tlsv1_2 = getattr(ssl, 'PROTOCOL_TLSv1_2', _notset) is not _notset
-if not has_tlsv1_2:
+if not ssl.HAS_TLSv1_2:
     error = """
 The `ssl` module does not advertise support for TLS 1.2.
 Please make sure that your Python installation was compiled against an OpenSSL