Skip to content

Commit

Permalink
Fix library of crypto for current Windows (yihong0618#159)
Browse files Browse the repository at this point in the history
* Fix library of crypto for current Windows

* Modify obok import statement

Only import this module when necessary

---------

Co-authored-by: Hsieh Chin Fan <pham@topo.tw>
  • Loading branch information
typebrook and Hsieh Chin Fan authored Mar 13, 2023
1 parent 5d2c89a commit 0a1991d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion book_maker/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
from os import environ as env

import book_maker.obok as obok
from book_maker.loader import BOOK_LOADER_DICT
from book_maker.translator import MODEL_DICT
from book_maker.utils import LANGUAGES, TO_LANGUAGE_CODE
Expand Down Expand Up @@ -190,6 +189,8 @@ def main():
OPENAI_API_KEY = ""

if options.book_from == "kobo":
import book_maker.obok as obok

device_path = options.device_path
if device_path is None:
raise Exception(
Expand Down
7 changes: 5 additions & 2 deletions book_maker/obok.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# The original code comes from:
# https://github.com/apprenticeharper/DeDRM_tools

# Version 4.1.2 March 2023
# Update library for crypto for current Windows

# Version 4.1.1 March 2023
# Make obok.py works as file selector

Expand Down Expand Up @@ -161,7 +164,7 @@
"""Manage all Kobo books, either encrypted or DRM-free."""
from __future__ import print_function

__version__ = "4.0.0"
__version__ = "4.1.2"
__about__ = "Obok v{0}\nCopyright © 2012-2020 Physisticated et al.".format(__version__)

import base64
Expand Down Expand Up @@ -211,7 +214,7 @@ def _load_crypto_libcrypto():
from ctypes.util import find_library

if sys.platform.startswith("win"):
libcrypto = find_library("libeay32")
libcrypto = find_library("libcrypto")
else:
libcrypto = find_library("crypto")

Expand Down

0 comments on commit 0a1991d

Please sign in to comment.