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

Replace Calibre path resolve system for some of the modules.

In Calibre there is a module, which registers two functions in global
scope, one for filepath and one for images path. It relies on additional
three variables, registered during application startup. I found it
overcomplicated, and couple of the resource paths has been calculated
using pkg_resource module.
This commit is contained in:
2020-04-12 13:58:53 +02:00
parent f488bc386e
commit bd9cb86c1c
4 changed files with 58 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ __copyright__ = '2008, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys, os, re, time, random, warnings
import pkg_resources
from ebook_converter.polyglot.builtins import codepoint_to_chr, unicode_type, range, hasenv, native_string_type
from math import floor
from functools import partial
@@ -34,7 +35,8 @@ _mt_inited = False
def _init_mimetypes():
global _mt_inited
import mimetypes
mimetypes.init([P('mime.types')])
mimetypes.init([pkg_resources.resource_filename('ebook_converter',
'data/mime.types')])
_mt_inited = True