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
@@ -10,7 +10,7 @@ import pickle
import re
import traceback
import pkg_resources
from importlib.resources import files as _resource_files
from ebook_converter.constants_old import config_dir
from ebook_converter.constants_old import filesystem_encoding
@@ -591,8 +591,7 @@ def exec_tweaks(path):
def default_tweaks_raw():
return pkg_resources.resource_filename('ebook_converter',
'data/default_tweaks.py')
return str(_resource_files('ebook_converter').joinpath('data/default_tweaks.py'))
def read_tweaks():
+2 -3
View File
@@ -1,5 +1,5 @@
import json
import pkg_resources
from importlib.resources import files
def get_lang():
@@ -39,8 +39,7 @@ def _load_iso639():
# excerpt form Calibre transform code which is executed during Calibre
# build).
if _iso639 is None:
src = pkg_resources.resource_filename('ebook_converter',
'data/iso_639-3.json')
src = str(files('ebook_converter').joinpath('data/iso_639-3.json'))
with open(src, 'rb') as f:
root = json.load(f)