1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-14 17:43:31 +02:00

Convert calibre modules to ebook_converter.

Here is the first batch of modules, which are needed for converting
several formats to LRF. Some of the logic has been change, more cleanups
will follow.
This commit is contained in:
2020-04-11 19:33:43 +02:00
parent 69d2e536c5
commit 0f9792df36
252 changed files with 1925 additions and 2344 deletions

View File

@@ -10,11 +10,11 @@ import os, zipfile, posixpath, importlib, threading, re, imp, sys
from collections import OrderedDict
from functools import partial
from calibre import as_unicode
from calibre.constants import ispy3
from calibre.customize import (Plugin, numeric_version, platform,
from ebook_converter import as_unicode
from ebook_converter.constants import ispy3
from ebook_converter.customize import (Plugin, numeric_version, platform,
InvalidPlugin, PluginNotFound)
from polyglot.builtins import (itervalues, map, string_or_bytes,
from ebook_converter.polyglot.builtins import (itervalues, map, string_or_bytes,
unicode_type, reload)
# PEP 302 based plugin loading mechanism, works around the bug in zipimport in
@@ -94,7 +94,7 @@ def load_translations(namespace, zfp):
if trans is None:
return
if trans is null:
from calibre.utils.localization import get_lang
from ebook_converter.utils.localization import get_lang
lang = get_lang()
if not lang or lang == 'en': # performance optimization
_translations_cache[zfp] = None
@@ -303,8 +303,8 @@ sys.meta_path.insert(0, loader)
if __name__ == '__main__':
from tempfile import NamedTemporaryFile
from calibre.customize.ui import add_plugin
from calibre import CurrentDir
from ebook_converter.customize.ui import add_plugin
from ebook_converter import CurrentDir
path = sys.argv[-1]
with NamedTemporaryFile(suffix='.zip') as f:
with zipfile.ZipFile(f, 'w') as zf: