def _backend_import_fallback(backends):
# If backends already exist just return them. This branch is here
# to get full line coverage from our tests.
if backends:
return backends
# if iter_entry_points fails to find any backends then manually try to
# import our current backends as a workaround for issues with application
# bundlers like pyinstaller, cx_freeze, etc
# OpenSSL is guaranteed to be present until we unbundle the backends.
from cryptography.hazmat.backends.openssl.backend import backend as be_ossl
backends = [be_ossl]
try:
from cryptography.hazmat.backends.commoncrypto.backend import (
backend as be_cc
)
except ImportError:
pass
else:
backends.append(be_cc)
return backends
评论列表
文章目录