1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-20 05:03:35 +02:00

Cleanup get_path usage in favor of pkg_resources.

This commit is contained in:
2020-04-12 18:33:23 +02:00
parent 0bf43ec6e8
commit 5aa0b1a0eb
17 changed files with 532 additions and 277 deletions

View File

@@ -7,6 +7,8 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, sys
import pkg_resources
from ebook_converter.customize.conversion import InputFormatPlugin
@@ -54,7 +56,12 @@ class LRFInput(InputFormatPlugin):
plot_map[ro] = imgstr[0].get('file')
self.log('Converting XML to HTML...')
styledoc = safe_xml_fromstring(P('templates/lrf.xsl', data=True))
with open(pkg_resources.
resource_filename('ebook_converter',
'data/lrf.xsl')) as fobj:
# TODO(gryf): change this nonsense to etree.parse() instead.
styledoc = safe_xml_fromstring(fobj.read())
media_type = MediaType()
styles = Styles()
text_block = TextBlock(styles, char_button_map, plot_map, log)