mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2026-05-04 04:35:49 -04:00
Finalize ‘exec’ migration and make it backward compatibility for now
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import pkg_resources
|
||||
|
||||
PROGRAM_NAME = 'ocrmypdf'
|
||||
@@ -6,5 +5,11 @@ PROGRAM_NAME = 'ocrmypdf'
|
||||
VERSION = pkg_resources.get_distribution('ocrmypdf').version
|
||||
|
||||
|
||||
def page_number(input_file):
|
||||
return int(os.path.basename(input_file)[0:6])
|
||||
# These imports are for v4.x backward compatibility for consumers of ocrmypdf
|
||||
# (if any). They are deprecated and will be removed in v5.x.
|
||||
from .exec import ghostscript, qpdf, tesseract, unpaper, get_program
|
||||
from .exceptions import ExitCode
|
||||
from .helpers import page_number, is_iterable_notstr
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import re
|
||||
import shutil
|
||||
from functools import lru_cache
|
||||
from ..exceptions import MissingDependencyError
|
||||
from .. import page_number
|
||||
from ..helpers import page_number
|
||||
from . import get_program
|
||||
from collections import namedtuple
|
||||
from textwrap import dedent
|
||||
|
||||
@@ -49,3 +49,7 @@ def re_symlink(input_file, soft_link_name, log=None):
|
||||
|
||||
def is_iterable_notstr(thing):
|
||||
return isinstance(thing, Iterable) and not isinstance(thing, str)
|
||||
|
||||
|
||||
def page_number(input_file):
|
||||
return int(os.path.basename(input_file)[0:6])
|
||||
|
||||
@@ -24,11 +24,11 @@ from ruffus import formatter, regex, Pipeline, suffix
|
||||
from .hocrtransform import HocrTransform
|
||||
from .pageinfo import pdf_get_all_pageinfo
|
||||
from .pdfa import generate_pdfa_def, file_claims_pdfa
|
||||
from .helpers import re_symlink, is_iterable_notstr
|
||||
from .helpers import re_symlink, is_iterable_notstr, page_number
|
||||
from .exec import ghostscript, tesseract, qpdf
|
||||
from .exceptions import *
|
||||
from . import leptonica
|
||||
from . import page_number, PROGRAM_NAME, VERSION
|
||||
from . import PROGRAM_NAME, VERSION
|
||||
|
||||
|
||||
VECTOR_PAGE_DPI = 400
|
||||
|
||||
Reference in New Issue
Block a user