pdfa: remove deprecated pkg_resources based access and tests
This commit is contained in:
@@ -19,12 +19,6 @@ except ImportError:
|
||||
from importlib.resources import files as package_files
|
||||
|
||||
import pikepdf
|
||||
import pkg_resources # deprecated
|
||||
|
||||
# Deprecated
|
||||
ICC_PROFILE_RELPATH = 'data/sRGB.icc'
|
||||
# Deprecated
|
||||
SRGB_ICC_PROFILE = pkg_resources.resource_filename('ocrmypdf', ICC_PROFILE_RELPATH)
|
||||
|
||||
SRGB_ICC_PROFILE_NAME = 'sRGB.icc'
|
||||
|
||||
@@ -108,7 +102,9 @@ def generate_pdfa_ps(target_filename: Path, icc: str = 'sRGB'):
|
||||
if icc != 'sRGB':
|
||||
raise NotImplementedError("Only supporting sRGB")
|
||||
|
||||
bytes_icc_profile = (package_files('ocrmypdf.data') / SRGB_ICC_PROFILE).read_bytes()
|
||||
bytes_icc_profile = (
|
||||
package_files('ocrmypdf.data') / SRGB_ICC_PROFILE_NAME
|
||||
).read_bytes()
|
||||
ps = '\n'.join(_make_postscript(icc, bytes_icc_profile, 3))
|
||||
|
||||
# We should have encoded everything to pure ASCII by this point, and
|
||||
|
||||
+1
-14
@@ -20,7 +20,7 @@ from ocrmypdf._pipeline import convert_to_pdfa, metadata_fixup
|
||||
from ocrmypdf._plugin_manager import get_plugin_manager
|
||||
from ocrmypdf.cli import get_parser
|
||||
from ocrmypdf.exceptions import ExitCode
|
||||
from ocrmypdf.pdfa import SRGB_ICC_PROFILE, file_claims_pdfa, generate_pdfa_ps
|
||||
from ocrmypdf.pdfa import file_claims_pdfa, generate_pdfa_ps
|
||||
from ocrmypdf.pdfinfo import PdfInfo
|
||||
|
||||
from .conftest import check_ocrmypdf, run_ocrmypdf
|
||||
@@ -273,19 +273,6 @@ def test_xml_metadata_preserved(test_file, output_type, resources, outpdf):
|
||||
)
|
||||
|
||||
|
||||
def test_srgb_in_unicode_path(tmp_path):
|
||||
"""Test that we can produce pdfmark when install path is not ASCII"""
|
||||
|
||||
dstdir = tmp_path / b'\xe4\x80\x80'.decode('utf-8')
|
||||
dstdir.mkdir()
|
||||
dst = dstdir / 'sRGB.icc'
|
||||
|
||||
copyfile(SRGB_ICC_PROFILE, fspath(dst))
|
||||
|
||||
with patch('ocrmypdf.pdfa.SRGB_ICC_PROFILE', new=str(dst)):
|
||||
generate_pdfa_ps(dstdir / 'out.ps')
|
||||
|
||||
|
||||
def test_kodak_toc(resources, outpdf):
|
||||
check_ocrmypdf(
|
||||
resources / 'kcs.pdf',
|
||||
|
||||
Reference in New Issue
Block a user