1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-21 13:41:30 +02:00

Renamed constants, to make room for real constants module

This commit is contained in:
2020-05-26 19:52:18 +02:00
parent 399456d9ad
commit 2c78d6e3a6
55 changed files with 59 additions and 58 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ try:
except EnvironmentError:
os.chdir(os.path.expanduser('~'))
from ebook_converter.constants import (iswindows, isosx, islinux, isfrozen,
from ebook_converter.constants_old import (iswindows, isosx, islinux, isfrozen,
isbsd, preferred_encoding, __appname__, __version__, __author__,
win32event, win32api, winerror, fcntl,
filesystem_encoding, plugins, config_dir)
+1 -1
View File
@@ -2,7 +2,7 @@ import importlib
import sys
import zipfile
from ebook_converter.constants import numeric_version, iswindows, isosx
from ebook_converter.constants_old import numeric_version, iswindows, isosx
from ebook_converter.ptempfile import PersistentTemporaryFile
+1 -1
View File
@@ -3,7 +3,7 @@ import os, glob, re
from ebook_converter import guess_type
from ebook_converter.customize import (FileTypePlugin, MetadataReaderPlugin,
MetadataWriterPlugin, PreferencesPlugin, InterfaceActionBase, StoreBase)
from ebook_converter.constants import numeric_version
from ebook_converter.constants_old import numeric_version
from ebook_converter.ebooks.metadata.archive import ArchiveExtract, KPFExtract, get_comic_metadata
from ebook_converter.ebooks.html.to_zip import HTML2ZIP
+1 -1
View File
@@ -2,7 +2,7 @@ import os
from collections import namedtuple
from ebook_converter import prints
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import iswindows
from ebook_converter.customize import Plugin
+1 -1
View File
@@ -108,7 +108,7 @@ def detect(*args, **kwargs):
def force_encoding(raw, verbose, assume_utf8=False):
from ebook_converter.constants import preferred_encoding
from ebook_converter.constants_old import preferred_encoding
try:
chardet = detect(raw[:1024*50])
+1 -1
View File
@@ -282,7 +282,7 @@ class ProgressBar(object):
def create_option_parser(args, log):
if '--version' in args:
from ebook_converter.constants import __appname__, __version__, __author__
from ebook_converter.constants_old import __appname__, __version__, __author__
log(os.path.basename(args[0]), '('+__appname__, __version__+')')
log('Created by:', __author__)
raise SystemExit(0)
@@ -10,7 +10,7 @@ from ebook_converter.ebooks.oeb.base import urlquote
from ebook_converter.ebooks.chardet import xml_to_unicode
from ebook_converter.customize.conversion import InputFormatPlugin
from ebook_converter.ptempfile import TemporaryDirectory
from ebook_converter.constants import filesystem_encoding
from ebook_converter.constants_old import filesystem_encoding
from ebook_converter.polyglot.builtins import as_bytes
__license__ = 'GPL v3'
@@ -4,7 +4,7 @@ import re
import tempfile
import urllib.parse
from ebook_converter.constants import islinux, isbsd
from ebook_converter.constants_old import islinux, isbsd
from ebook_converter.customize.conversion import (InputFormatPlugin,
OptionRecommendation)
from ebook_converter.utils.localization import get_lang
@@ -139,7 +139,7 @@ class LRFOutput(OutputFormatPlugin):
def convert_images(self, pages, opts, wide):
from ebook_converter.ebooks.lrf.pylrs.pylrs import Book, BookSetting, ImageStream, ImageBlock
from uuid import uuid4
from ebook_converter.constants import __appname__, __version__
from ebook_converter.constants_old import __appname__, __version__
width, height = (784, 1012) if wide else (584, 754)
@@ -144,7 +144,7 @@ class PDFOutput(OutputFormatPlugin):
from PyQt5.QtWebEngineCore import QWebEngineUrlScheme
from PyQt5.QtWebEngineWidgets import QWebEnginePage # noqa
from ebook_converter.gui2 import must_use_qt
from ebook_converter.constants import FAKE_PROTOCOL
from ebook_converter.constants_old import FAKE_PROTOCOL
scheme = QWebEngineUrlScheme(FAKE_PROTOCOL.encode('ascii'))
scheme.setSyntax(QWebEngineUrlScheme.Syntax.Host)
scheme.setFlags(QWebEngineUrlScheme.SecureScheme)
@@ -1,7 +1,7 @@
import os
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
from ebook_converter.constants import numeric_version
from ebook_converter.constants_old import numeric_version
from ebook_converter import walk
@@ -2,7 +2,7 @@ import os
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
from ebook_converter.ptempfile import TemporaryDirectory
from ebook_converter.constants import __appname__, __version__
from ebook_converter.constants_old import __appname__, __version__
__license__ = 'GPL 3'
+1 -1
View File
@@ -16,7 +16,7 @@ from ebook_converter.utils.date import parse_date
from ebook_converter.utils.zipfile import ZipFile
from ebook_converter import (extract, walk, isbytestring, filesystem_encoding,
get_types_map)
from ebook_converter.constants import __version__
from ebook_converter.constants_old import __version__
DEBUG_README=b'''
+1 -1
View File
@@ -11,7 +11,7 @@ from PyQt5.Qt import (
)
from ebook_converter import force_unicode, fit_image
from ebook_converter.constants import __appname__, __version__
from ebook_converter.constants_old import __appname__, __version__
from ebook_converter.ebooks.metadata import fmt_sidx
from ebook_converter.ebooks.metadata.book.base import Metadata
from ebook_converter.ebooks.metadata.book.formatter import SafeFormat
+1 -1
View File
@@ -2,7 +2,7 @@ import os
from lxml.html.builder import IMG, HR
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import iswindows
from ebook_converter.ebooks.docx.names import barename
from ebook_converter.utils.filenames import ascii_filename
from ebook_converter.utils.img import resize_to_fit, image_to_data
@@ -4,7 +4,7 @@ from lxml import etree
from lxml.builder import ElementMaker
from ebook_converter import guess_type
from ebook_converter.constants import numeric_version, __appname__
from ebook_converter.constants_old import numeric_version, __appname__
from ebook_converter.ebooks.docx.names import DOCXNamespace
from ebook_converter.ebooks.metadata import authors_to_string
from ebook_converter.ebooks.pdf.render.common import PAPER_SIZES
+1 -1
View File
@@ -10,7 +10,7 @@ import uuid
from lxml import etree
from ebook_converter import prepare_string_for_xml
from ebook_converter.constants import __appname__, __version__
from ebook_converter.constants_old import __appname__, __version__
from ebook_converter.utils.localization import lang_as_iso639_1
from ebook_converter.utils.xml_parse import safe_xml_fromstring
from ebook_converter.utils.img import save_cover_data_to
+1 -1
View File
@@ -9,7 +9,7 @@ import urllib.parse
from ebook_converter.ebooks.oeb.base import urlunquote
from ebook_converter.ebooks.chardet import detect_xml_encoding
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import iswindows
from ebook_converter import unicode_path, as_unicode, replace_entities
+1 -1
View File
@@ -1,7 +1,7 @@
import textwrap, os, glob
from ebook_converter.customize import FileTypePlugin
from ebook_converter.constants import numeric_version
from ebook_converter.constants_old import numeric_version
__license__ = 'GPL v3'
@@ -23,7 +23,7 @@ import bs4
from ebook_converter import (
__appname__, entity_to_unicode, fit_image, force_unicode, preferred_encoding
)
from ebook_converter.constants import filesystem_encoding
from ebook_converter.constants_old import filesystem_encoding
from ebook_converter.devices.interface import DevicePlugin as Device
from ebook_converter.ebooks import ConversionError
from ebook_converter.ebooks.BeautifulSoup import html5_parser
+1 -1
View File
@@ -622,7 +622,7 @@ class LRFMetaFile(object):
def option_parser():
from ebook_converter.utils.config import OptionParser
from ebook_converter.constants import __appname__, __version__
from ebook_converter.constants_old import __appname__, __version__
parser = OptionParser(usage=('''%prog [options] mybook.lrf
+1 -1
View File
@@ -1,7 +1,7 @@
import copy, traceback
from ebook_converter import prints
from ebook_converter.constants import DEBUG
from ebook_converter.constants_old import DEBUG
from ebook_converter.ebooks.metadata.book import (SC_COPYABLE_FIELDS,
SC_FIELDS_COPY_NOT_NULL, STANDARD_METADATA_FIELDS,
TOP_LEVEL_IDENTIFIERS, ALL_METADATA_FIELDS)
@@ -7,7 +7,7 @@ import json, traceback
from datetime import datetime, time
from ebook_converter.ebooks.metadata.book import SERIALIZABLE_FIELDS
from ebook_converter.constants import filesystem_encoding, preferred_encoding
from ebook_converter.constants_old import filesystem_encoding, preferred_encoding
from ebook_converter.library.field_metadata import FieldMetadata
from ebook_converter import isbytestring
from ebook_converter.polyglot.builtins import as_bytes
+1 -1
View File
@@ -1,7 +1,7 @@
import os, re, collections
from ebook_converter.utils.config import prefs
from ebook_converter.constants import filesystem_encoding
from ebook_converter.constants_old import filesystem_encoding
from ebook_converter.ebooks.metadata.opf2 import OPF
from ebook_converter import isbytestring
from ebook_converter.customize.ui import get_file_type_metadata, set_file_type_metadata
+2 -1
View File
@@ -16,7 +16,8 @@ import uuid
from lxml import etree
from ebook_converter.ebooks import escape_xpath_attr
from ebook_converter.constants import __appname__, __version__, filesystem_encoding
from ebook_converter.constants_old import __appname__, __version__, \
filesystem_encoding
from ebook_converter.ebooks.metadata.toc import TOC
from ebook_converter.ebooks.metadata.utils import parse_opf, pretty_print_opf as _pretty_print
from ebook_converter.ebooks.metadata import string_to_authors, MetaInformation, check_isbn
+1 -1
View File
@@ -5,7 +5,7 @@ import os, subprocess, shutil, re
from functools import partial
from ebook_converter import prints
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import iswindows
from ebook_converter.ptempfile import TemporaryDirectory
from ebook_converter.ebooks.metadata import (
MetaInformation, string_to_authors, check_isbn, check_doi)
+1 -1
View File
@@ -8,7 +8,7 @@ import urllib.parse
from lxml import etree
from lxml.builder import ElementMaker
from ebook_converter.constants import __appname__, __version__
from ebook_converter.constants_old import __appname__, __version__
from ebook_converter.ebooks.chardet import xml_to_unicode
from ebook_converter.utils.xml_parse import safe_xml_fromstring
from ebook_converter.utils.cleantext import clean_xml_chars
+1 -1
View File
@@ -2,7 +2,7 @@ import re
from struct import pack
from io import BytesIO
from ebook_converter.constants import iswindows, isosx
from ebook_converter.constants_old import iswindows, isosx
from ebook_converter.ebooks.mobi.utils import (utf8_text, to_base)
from ebook_converter.utils.localization import lang_as_iso639_1
from ebook_converter.ebooks.metadata import authors_to_sort_string
+1 -1
View File
@@ -10,7 +10,7 @@ import string
from lxml import etree, html
from ebook_converter import force_unicode
from ebook_converter.constants import filesystem_encoding, __version__
from ebook_converter.constants_old import filesystem_encoding, __version__
from ebook_converter.utils.xml_parse import safe_xml_fromstring
from ebook_converter.ebooks.chardet import xml_to_unicode
from ebook_converter.ebooks.conversion.preprocess import CSSPreProcessor
+1 -1
View File
@@ -4,7 +4,7 @@ from lxml import etree, html
from ebook_converter import xml_replace_entities, force_unicode
from ebook_converter.utils.xml_parse import safe_xml_fromstring
from ebook_converter.constants import filesystem_encoding
from ebook_converter.constants_old import filesystem_encoding
from ebook_converter.ebooks.chardet import xml_to_unicode, strip_encoding_declarations
@@ -16,7 +16,7 @@ import urllib.parse
from css_parser import getUrls, replaceUrls
from ebook_converter import CurrentDir, walk
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import iswindows
from ebook_converter.customize.ui import plugin_for_input_format, plugin_for_output_format
from ebook_converter.ebooks import escape_xpath_attr
from ebook_converter.ebooks.chardet import xml_to_unicode
+1 -1
View File
@@ -21,7 +21,7 @@ from ebook_converter.utils.xml_parse import safe_xml_fromstring
from ebook_converter.utils.cleantext import clean_xml_chars
from ebook_converter.utils.localization import get_lang
from ebook_converter.ptempfile import TemporaryDirectory
from ebook_converter.constants import __appname__, __version__
from ebook_converter.constants_old import __appname__, __version__
from ebook_converter import guess_type, xml_replace_entities
from ebook_converter.polyglot.urllib import unquote
@@ -5,7 +5,7 @@ import pkg_resources
import urllib.parse
from ebook_converter import guess_type, strftime
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import iswindows
from ebook_converter.ebooks.oeb.base import XPath, XHTML_NS, XHTML, xml2text, urlnormalize
from ebook_converter.library.comments import comments_to_html, markdown
from ebook_converter.utils.date import is_date_undefined, as_local_time
+1 -1
View File
@@ -6,7 +6,7 @@ import subprocess
import sys
from ebook_converter import CurrentDir, xml_replace_entities, prints
from ebook_converter.constants import (
from ebook_converter.constants_old import (
filesystem_encoding, isbsd, islinux, isosx, iswindows
)
from ebook_converter.ebooks import ConversionError, DRMError
+1 -1
View File
@@ -26,7 +26,7 @@ def generate_test_db(library_path, # {{{
max_tags=10
):
import random, string, os, sys, time
from ebook_converter.constants import preferred_encoding
from ebook_converter.constants_old import preferred_encoding
if not os.path.exists(library_path):
os.makedirs(library_path)
+1 -1
View File
@@ -3,7 +3,7 @@ import re
import bs4
from ebook_converter import prepare_string_for_xml
from ebook_converter.constants import preferred_encoding
from ebook_converter.constants_old import preferred_encoding
from ebook_converter.ebooks.BeautifulSoup import html5_parser
from ebook_converter.utils.html2text import html2text
+1 -1
View File
@@ -6,7 +6,7 @@ being closed.
"""
import tempfile, os, atexit
from ebook_converter.constants import (__version__, __appname__, filesystem_encoding,
from ebook_converter.constants_old import (__version__, __appname__, filesystem_encoding,
iswindows, get_windows_temp_path, isosx)
+1 -1
View File
@@ -1,7 +1,7 @@
import re
import html.entities
from ebook_converter.constants import plugins, preferred_encoding
from ebook_converter.constants_old import plugins, preferred_encoding
def ascii_pat(for_binary=False):
+1 -1
View File
@@ -5,7 +5,7 @@ import optparse
import os
from copy import deepcopy
from ebook_converter.constants import (
from ebook_converter.constants_old import (
CONFIG_DIR_MODE, __appname__, __author__, config_dir, get_version, iswindows
)
from ebook_converter.utils.config_base import (
+1 -1
View File
@@ -9,7 +9,7 @@ from copy import deepcopy
import pkg_resources
from ebook_converter.utils.lock import ExclusiveFile
from ebook_converter.constants import config_dir, CONFIG_DIR_MODE, preferred_encoding, filesystem_encoding, iswindows
from ebook_converter.constants_old import config_dir, CONFIG_DIR_MODE, preferred_encoding, filesystem_encoding, iswindows
plugin_dir = os.path.join(config_dir, 'plugins')
+1 -1
View File
@@ -3,7 +3,7 @@ from datetime import datetime, time as dtime, timedelta, MINYEAR, MAXYEAR
from functools import partial
from ebook_converter import strftime
from ebook_converter.constants import iswindows, isosx, plugins, preferred_encoding
from ebook_converter.constants_old import iswindows, isosx, plugins, preferred_encoding
from ebook_converter.utils.iso8601 import utc_tz, local_tz, UNDEFINED_DATE
from ebook_converter.utils.localization import lcdata
+1 -1
View File
@@ -9,7 +9,7 @@ import time
from math import ceil
from ebook_converter import force_unicode, isbytestring, prints, sanitize_file_name
from ebook_converter.constants import (
from ebook_converter.constants_old import (
filesystem_encoding, iswindows, plugins, preferred_encoding, isosx
)
from ebook_converter.utils.localization import get_udc
+1 -1
View File
@@ -3,7 +3,7 @@ from collections import defaultdict
from threading import Thread
from ebook_converter import walk, prints, as_unicode
from ebook_converter.constants import (config_dir, iswindows, isosx, plugins, DEBUG,
from ebook_converter.constants_old import (config_dir, iswindows, isosx, plugins, DEBUG,
isworker, filesystem_encoding)
from ebook_converter.utils.fonts.metadata import FontMetadata, UnsupportedFont
+1 -1
View File
@@ -6,7 +6,7 @@ Created on 23 Sep 2010
import re, string, traceback, numbers
from ebook_converter import prints
from ebook_converter.constants import DEBUG
from ebook_converter.constants_old import DEBUG
from ebook_converter.utils.formatter_functions import formatter_functions
from ebook_converter.polyglot.builtins import error_message
+1 -1
View File
@@ -7,7 +7,7 @@ import inspect, re, traceback, numbers
from math import trunc
from ebook_converter import human_readable
from ebook_converter.constants import DEBUG
from ebook_converter.constants_old import DEBUG
from ebook_converter.ebooks.metadata import title_sort
from ebook_converter.utils.config import tweaks
from ebook_converter.utils.titlecase import titlecase
+1 -1
View File
@@ -3,7 +3,7 @@ import sys
import unicodedata
# Setup code {{{
from ebook_converter.constants import plugins
from ebook_converter.constants_old import plugins
from ebook_converter.polyglot.builtins import cmp
from ebook_converter.utils.config_base import tweaks
+1 -1
View File
@@ -12,7 +12,7 @@ from threading import Thread
#from PyQt5.QtGui import QColor, QImage, QImageReader, QImageWriter, QPixmap, QTransform
from ebook_converter import fit_image, force_unicode
from ebook_converter.constants import iswindows, plugins
from ebook_converter.constants_old import iswindows, plugins
from ebook_converter.ptempfile import TemporaryDirectory
from ebook_converter.utils.config_base import tweaks
from ebook_converter.utils.filenames import atomic_rename
+4 -4
View File
@@ -5,10 +5,10 @@ import sys
import threading
from ebook_converter import force_unicode
from ebook_converter.constants import filesystem_encoding
from ebook_converter.constants import get_windows_username
from ebook_converter.constants import islinux
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import filesystem_encoding
from ebook_converter.constants_old import get_windows_username
from ebook_converter.constants_old import islinux
from ebook_converter.constants_old import iswindows
from ebook_converter.utils.filenames import ascii_filename
+1 -1
View File
@@ -1,7 +1,7 @@
import subprocess, os, sys, time
from functools import partial
from ebook_converter.constants import isosx, isfrozen, filesystem_encoding
from ebook_converter.constants_old import isosx, isfrozen, filesystem_encoding
from ebook_converter.utils.config import prefs
from ebook_converter.ptempfile import PersistentTemporaryFile, base_dir
from ebook_converter.utils.serialize import msgpack_dumps
+1 -1
View File
@@ -3,7 +3,7 @@ from multiprocessing.connection import Client
from threading import Thread
from contextlib import closing
from ebook_converter.constants import iswindows
from ebook_converter.constants_old import iswindows
from ebook_converter.utils.ipc import eintr_retry_call
from ebook_converter.utils.ipc.launch import Worker
from ebook_converter.utils.serialize import msgpack_loads, msgpack_dumps
+1 -1
View File
@@ -2,7 +2,7 @@ from datetime import datetime
from dateutil.tz import tzlocal, tzutc, tzoffset
from ebook_converter.constants import plugins
from ebook_converter.constants_old import plugins
# speedup, err = plugins['speedup']
# if not speedup:
# raise RuntimeError(err)
+2 -2
View File
@@ -8,7 +8,7 @@ import tempfile
import time
from functools import partial
from ebook_converter.constants import (
from ebook_converter.constants_old import (
__appname__, fcntl, filesystem_encoding, islinux, isosx, iswindows, plugins
)
from ebook_converter.utils.monotonic import monotonic
@@ -16,7 +16,7 @@ from ebook_converter.utils.monotonic import monotonic
# speedup = plugins['speedup'][0]
if iswindows:
import msvcrt, win32file, pywintypes, winerror, win32api, win32event
from ebook_converter.constants import get_windows_username
from ebook_converter.constants_old import get_windows_username
excl_file_mode = stat.S_IREAD | stat.S_IWRITE
else:
excl_file_mode = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH
+1 -1
View File
@@ -1,7 +1,7 @@
try:
from time import monotonic
except ImportError:
from ebook_converter.constants import plugins
from ebook_converter.constants_old import plugins
monotonicp, err = plugins['monotonic']
if err:
+1 -1
View File
@@ -17,7 +17,7 @@ file before deleting it.
import os, sys
from ebook_converter.polyglot.builtins import reraise
from ebook_converter.constants import iswindows, plugins
from ebook_converter.constants_old import iswindows, plugins
__license__ = 'GPL v3'