File tree 1 file changed +27
-15
lines changed
1 file changed +27
-15
lines changed Original file line number Diff line number Diff line change 7
7
old to handle TLSv1.2.
8
8
"""
9
9
10
- try :
11
- import ssl
12
- except ImportError :
13
- pass
14
- else :
15
- import sys
16
-
17
- # Checks for OpenSSL 1.0.1 on MacOS
18
- if sys .platform == "darwin" and ssl .OPENSSL_VERSION_NUMBER < 0x1000100f :
19
- try :
20
- from pip ._vendor .urllib3 .contrib import securetransport
21
- except (ImportError , OSError ):
22
- pass
23
- else :
24
- securetransport .inject_into_urllib3 ()
10
+ import sys
11
+
12
+
13
+ def inject_securetransport ():
14
+ # type: () -> None
15
+ # Only relevant on macOS
16
+ if sys .platform != "darwin" :
17
+ return
18
+
19
+ try :
20
+ import ssl
21
+ except ImportError :
22
+ return
23
+
24
+ # Checks for OpenSSL 1.0.1
25
+ if ssl .OPENSSL_VERSION_NUMBER >= 0x1000100f :
26
+ return
27
+
28
+ try :
29
+ from pip ._vendor .urllib3 .contrib import securetransport
30
+ except (ImportError , OSError ):
31
+ return
32
+
33
+ securetransport .inject_into_urllib3 ()
34
+
35
+
36
+ inject_securetransport ()
You can’t perform that action at this time.
0 commit comments