importlib helpers don't provide importlib.thing, but importlib_thing

Fix everywhere.
This commit is contained in:
James R. Barlow 2021-09-14 00:15:07 -07:00
parent 3534742ef9
commit 4d67812d51
4 changed files with 6 additions and 6 deletions

View File

@ -88,7 +88,7 @@ if on_rtd:
]
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
from importlib.metadata import version as package_version
from importlib_metadata import version as package_version
# The full version, including alpha/beta/rc tags.
release = package_version('ocrmypdf').version

View File

@ -49,8 +49,8 @@ install_requires =
cffi>=1.9.1 # must be a setup and install requirement
coloredlogs>=14.0 # strictly optional
img2pdf>=0.3.0,<0.5 # pure Python
importlib-metadata>=4;python_version<'3.8'
importlib-resources>=5;python_version<'3.9'
importlib-metadata>=4 # until Python 3.8
importlib-resources>=5 # until Python 3.9
pdfminer.six!=20200720,>=20191110,<=20201018
pikepdf>=2.10.0
pikepdf<3;implementation_name=="pypy" and python_version=='3.6'

View File

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from importlib.metadata import version as _package_version
from importlib_metadata import version as _package_version
PROGRAM_NAME = 'ocrmypdf'

View File

@ -10,10 +10,10 @@ Utilities for PDF/A production and confirmation with Ghostspcript.
"""
import base64
import importlib.resources
from pathlib import Path
from typing import Dict, Iterator, Union
import importlib_resources
import pikepdf
import pkg_resources # deprecated
@ -104,7 +104,7 @@ def generate_pdfa_ps(target_filename: Path, icc: str = 'sRGB'):
if icc != 'sRGB':
raise NotImplementedError("Only supporting sRGB")
bytes_icc_profile = importlib.resources.read_binary(
bytes_icc_profile = importlib_resources.read_binary(
'ocrmypdf.data', SRGB_ICC_PROFILE_NAME
)
ps = '\n'.join(_make_postscript(icc, bytes_icc_profile, 3))