Compare commits

...
3 Commits
7 changed files with 32 additions and 11 deletions
+8
View File
@@ -12,6 +12,14 @@ may be unreliable. Use the API to depend on precise behavior.
The public API may be useful in scripts that launch OCRmyPDF processes or that
wish to use some of its features for working with PDFs.
v11.7.2
=======
- Updated pinned versions in main.txt, primarily to upgrade Pillow to 8.1.2, due
to recently disclosed security vulnerabilities in that software.
- The ``--sidecar`` parameter now causes an exception if set to the same file as
the input or output PDF.
v11.7.1
=======
+6 -6
View File
@@ -1,12 +1,12 @@
# requirements.txt can be used to replicate the developer's build environment
# setup.py lists a separate set of requirements that are looser to simplify
# installation
cffi == 1.14.3
coloredlogs == 14.0 # technically optional
cffi == 1.14.5
coloredlogs == 15.0 # technically optional
img2pdf == 0.4.0
pdfminer.six == 20201018
pikepdf == 2.0.0
pikepdf == 2.9.0
pluggy == 0.13.1
Pillow == 8.0.1
reportlab == 3.5.55
tqdm == 4.51.0
Pillow == 8.1.2
reportlab == 3.5.65
tqdm == 4.59.0
+3 -3
View File
@@ -1,7 +1,7 @@
pytest >= 5.0.0
pytest >= 6.0.0
pytest-helpers-namespace >= 2019.1.8
pytest-xdist >= 1.31.0
pytest-cov >= 2.10.0
pytest-xdist >= 2.2.0
pytest-cov >= 2.11.1
python-xmp-toolkit == 2.0.1 # requires apt-get install libexempi3
# or brew install exempi
#PyMuPDF == 1.13.4 # optional
+1 -1
View File
@@ -1 +1 @@
watchdog == 0.10.2
watchdog == 1.0.2
+4
View File
@@ -112,6 +112,10 @@ def check_options_sidecar(options):
"--sidecar filename must be specified when output file is stdout."
)
options.sidecar = options.output_file + '.txt'
if options.sidecar == options.input_file or options.sidecar == options.output_file:
raise BadArgsError(
"--sidecar file must be different from the input and output files"
)
def check_options_preprocessing(options):
+2 -1
View File
@@ -167,7 +167,8 @@ Online documentation is located at:
metavar='FILE',
help="Generate sidecar text files that contain the same text recognized "
"by Tesseract. This may be useful for building a OCR text database. "
"If FILE is omitted, the sidecar file be named {output_file}.txt "
"If FILE is omitted, the sidecar file be named {output_file}.txt; the next "
"argument must NOT be the name of the input PDF. "
"If FILE is set to '-', the sidecar is written to stdout (a "
"convenient way to preview OCR quality). The output file and sidecar "
"may not both use stdout at the same time.",
+8
View File
@@ -18,6 +18,8 @@ from ocrmypdf.cli import get_parser
from ocrmypdf.exceptions import BadArgsError, MissingDependencyError
from ocrmypdf.pdfinfo import PdfInfo
run_ocrmypdf_api = pytest.helpers.run_ocrmypdf_api
def make_opts_pm(input_file='a.pdf', output_file='b.pdf', language='eng', **kwargs):
if language is not None:
@@ -270,3 +272,9 @@ def test_two_languages():
*make_opts_pm(language='fakelang1+fakelang2'), {'fakelang1', 'fakelang2'}
)
mock.assert_called()
def test_sidecar_equals_output(resources, no_outpdf):
op = no_outpdf
with pytest.raises(BadArgsError, match=r'--sidecar'):
run_ocrmypdf_api(resources / 'trivial.pdf', op, '--sidecar', op)