mirror of
https://github.com/Leseratte10/acsm-calibre-plugin.git
synced 2024-12-22 17:29:56 +06:00
Fix plugin when libcrypto override variable is not set
This commit is contained in:
parent
963d42f785
commit
0b228edf15
@ -285,18 +285,23 @@ class ACSMInput(FileTypePlugin):
|
|||||||
|
|
||||||
# Okay, now all the modules are available, import the Adobe modules.
|
# Okay, now all the modules are available, import the Adobe modules.
|
||||||
|
|
||||||
|
|
||||||
|
# On some systems, like NixOS, the path to libcrypto and libssl
|
||||||
|
# isn't autodetected correctly. To fix this, allow overriding
|
||||||
|
# these paths using environment variables.
|
||||||
# Crucial to import first, as libadobe imports oscrypto as well
|
# Crucial to import first, as libadobe imports oscrypto as well
|
||||||
|
|
||||||
libcrypto_path = os.environ["ACSM_LIBCRYPTO"]
|
libcrypto_path = os.getenv("ACSM_LIBCRYPTO", None)
|
||||||
libssl_path = os.environ["ACSM_LIBSSL"]
|
libssl_path = os.getenv("ACSM_LIBSSL", None)
|
||||||
|
|
||||||
if os.path.exists(libcrypto_path) and os.path.exists(libssl_path):
|
if libcrypto_path is not None and libssl_path is not None:
|
||||||
import oscrypto
|
if os.path.exists(libcrypto_path) and os.path.exists(libssl_path):
|
||||||
|
import oscrypto # type: ignore
|
||||||
|
|
||||||
oscrypto.use_openssl(
|
oscrypto.use_openssl(
|
||||||
libcrypto_path = libcrypto_path,
|
libcrypto_path = libcrypto_path,
|
||||||
libssl_path = libssl_path,
|
libssl_path = libssl_path,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
|
from libadobe import createDeviceKeyFile, update_account_path, sendHTTPRequest
|
||||||
|
Loading…
Reference in New Issue
Block a user