Skip to content

Commit

Permalink
Skip path checks for OpenSSL on macOS 11+
Browse files Browse the repository at this point in the history
They will fail with the system OpenSSL/LibreSSL install since it isn't
present in the filesystem
  • Loading branch information
wbond committed Sep 30, 2022
1 parent 7aebcf3 commit 222a558
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions oscrypto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,17 @@ def use_openssl(libcrypto_path, libssl_path, trust_list_path=None):
if not isinstance(libssl_path, str_cls):
raise ValueError('libssl_path must be a unicode string, not %s' % type_name(libssl_path))

if not os.path.exists(libcrypto_path):
raise LibraryNotFoundError('libcrypto does not exist at %s' % libcrypto_path)
do_path_checks = True
if sys.platform == 'darwin':
mac_version_info = tuple(map(int, platform.mac_ver()[0].split('.')[:2]))
do_path_checks = mac_version_info < (11,)

if not os.path.exists(libssl_path):
raise LibraryNotFoundError('libssl does not exist at %s' % libssl_path)
if do_path_checks:
if not os.path.exists(libcrypto_path):
raise LibraryNotFoundError('libcrypto does not exist at %s' % libcrypto_path)

if not os.path.exists(libssl_path):
raise LibraryNotFoundError('libssl does not exist at %s' % libssl_path)

if trust_list_path is not None:
if not isinstance(trust_list_path, str_cls):
Expand Down

0 comments on commit 222a558

Please sign in to comment.