Replace pkg_resources with importlib.resources for Python 3.14 compatibility

This commit is contained in:
wave1martian
2026-03-08 20:24:24 +01:00
parent c89fc132b8
commit 17c304066a
11 changed files with 32 additions and 44 deletions
+2 -3
View File
@@ -2,7 +2,7 @@
CSS property propagation class.
"""
import os, re, logging, copy, unicodedata, numbers
import pkg_resources
from importlib.resources import files
from operator import itemgetter
from weakref import WeakKeyDictionary
from xml.dom import SyntaxErr as CSSSyntaxError
@@ -28,8 +28,7 @@ _html_css_stylesheet = None
def html_css_stylesheet():
global _html_css_stylesheet
if _html_css_stylesheet is None:
with open(pkg_resources.resource_filename('ebook_converter',
'data/html.css'), 'rb') as f:
with open(str(files('ebook_converter').joinpath('data/html.css')), 'rb') as f:
html_css = f.read().decode('utf-8')
_html_css_stylesheet = parseString(html_css, validate=False)
return _html_css_stylesheet