mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-02 11:10:18 +03:00
Search for multiple libssl versions on macOS 10.15
This commit is contained in:
parent
58614e1570
commit
b77109424f
|
@ -17,13 +17,21 @@ __log__ = logging.getLogger(__name__)
|
||||||
|
|
||||||
def _find_ssl_lib():
|
def _find_ssl_lib():
|
||||||
lib = ctypes.util.find_library('ssl')
|
lib = ctypes.util.find_library('ssl')
|
||||||
# macOS catalina traps the use of unversioned crypto libraries.
|
# macOS 10.15 segfaults on unversioned crypto libraries.
|
||||||
# We therefore add the current stable version here
|
# We therefore pin the current stable version here
|
||||||
# Credit for fix goes to Sarah Harvey (@worldwise001)
|
# Credit for fix goes to Sarah Harvey (@worldwise001)
|
||||||
# https://www.shh.sh/2020/01/04/python-abort-trap-6.html
|
# https://www.shh.sh/2020/01/04/python-abort-trap-6.html
|
||||||
if sys.platform == 'darwin' and platform.mac_ver()[0].startswith('10.15') and lib.endswith('libssl.dylib'):
|
if sys.platform == 'darwin':
|
||||||
# libssl.44.dylib is in libressl-2.6 which has a OpenSSL 1.0.1-compatible API
|
_, major, minor = platform.mac_ver()[0].split('.')
|
||||||
lib = lib.replace('libssl.dylib', 'libssl.44.dylib')
|
# macOS 10.14 "mojave" is the last known major release
|
||||||
|
# to support unversioned libssl.dylib. Anything above
|
||||||
|
# needs specific versions
|
||||||
|
if int(major) > 14:
|
||||||
|
lib = (
|
||||||
|
ctypes.util.find_library('libssl.46') or
|
||||||
|
ctypes.util.find_library('libssl.44') or
|
||||||
|
ctypes.util.find_library('libssl.42')
|
||||||
|
)
|
||||||
if not lib:
|
if not lib:
|
||||||
raise OSError('no library called "ssl" found')
|
raise OSError('no library called "ssl" found')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user