|
9 | 9 | import sys |
10 | 10 |
|
11 | 11 | error_str = "" |
12 | | -try: |
13 | | - from .boringssl_wrap import SSLConnection, SSLContext, SSLCert |
14 | | - implementation = "BoringSSL" |
15 | | -except Exception as e: |
16 | | - error_str = "import boringssl except: %r;" % e |
| 12 | +implementation = None |
17 | 13 |
|
| 14 | +def init(): |
| 15 | + global implementation |
18 | 16 | try: |
19 | | - from .tlslite_wrap import SSLConnection, SSLContext, SSLCert |
20 | | - implementation = "TLSLite, import boringssl except:" + error_str |
| 17 | + from .boringssl_wrap import SSLConnection, SSLContext, SSLCert |
| 18 | + implementation = "BoringSSL" |
| 19 | + return SSLConnection, SSLContext, SSLCert |
21 | 20 | except Exception as e: |
22 | | - error_str += "import tlslite except: %r;" % e |
| 21 | + error_str = "import boringssl except: %r;" % e |
23 | 22 |
|
24 | | - if sys.version_info[0] == 3: |
25 | | - from .ssl_wrap import SSLConnection, SSLContext, SSLCert |
| 23 | + if sys.version_info[0] == 3: |
| 24 | + from .ssl_wrap import SSLConnection, SSLContext, SSLCert |
26 | 25 |
|
27 | | - implementation = "ssl, import tlslite except:" + error_str |
28 | | - else: |
29 | | - from .pyopenssl_wrap import SSLConnection, SSLContext, SSLCert |
30 | | - implementation = "OpenSSL, import tlslite except:" + error_str |
| 26 | + implementation = "ssl, import tlslite except:" + error_str |
| 27 | + else: |
| 28 | + from .pyopenssl_wrap import SSLConnection, SSLContext, SSLCert |
| 29 | + implementation = "OpenSSL, import tlslite except:" + error_str |
| 30 | + |
| 31 | + return SSLConnection, SSLContext, SSLCert |
| 32 | + |
| 33 | + |
| 34 | +SSLConnection, SSLContext, SSLCert = init() |
0 commit comments