Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d32324859c | ||
|
|
48222b87b5 | ||
|
|
62e5edc72b | ||
|
|
2846d46bb8 |
-24
@@ -1,24 +0,0 @@
|
|||||||
[paths]
|
|
||||||
source =
|
|
||||||
src
|
|
||||||
*/site-packages
|
|
||||||
|
|
||||||
[run]
|
|
||||||
branch = true
|
|
||||||
parallel = true
|
|
||||||
concurrency =
|
|
||||||
thread
|
|
||||||
multiprocessing
|
|
||||||
source =
|
|
||||||
src/ocrmypdf
|
|
||||||
|
|
||||||
[report]
|
|
||||||
exclude_lines =
|
|
||||||
pragma: no cover
|
|
||||||
def __repr__
|
|
||||||
raise AssertionError
|
|
||||||
raise NotImplementedError
|
|
||||||
if 0:
|
|
||||||
if False:
|
|
||||||
if __name__ == .__main__.:
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
@@ -12,6 +12,12 @@ 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
|
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.
|
wish to use some of its features for working with PDFs.
|
||||||
|
|
||||||
|
v11.4.5
|
||||||
|
=======
|
||||||
|
|
||||||
|
- Fixed an issue where files may not be closed when the API is used.
|
||||||
|
- Improved ``setup.cfg`` with better settings for test coverage.
|
||||||
|
|
||||||
v11.4.4
|
v11.4.4
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ filterwarnings =
|
|||||||
ignore:.*XMLParser.*:DeprecationWarning
|
ignore:.*XMLParser.*:DeprecationWarning
|
||||||
markers =
|
markers =
|
||||||
slow
|
slow
|
||||||
|
addopts =
|
||||||
|
-n auto
|
||||||
|
|
||||||
[isort]
|
[isort]
|
||||||
multi_line_output=3
|
multi_line_output=3
|
||||||
@@ -27,3 +29,30 @@ known_third_party = PIL,_cffi_backend,cffi,flask,img2pdf,pdfminer,pikepdf,pkg_re
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
license_file = LICENSE
|
license_file = LICENSE
|
||||||
|
|
||||||
|
[coverage:paths]
|
||||||
|
source =
|
||||||
|
src/
|
||||||
|
|
||||||
|
[coverage:run]
|
||||||
|
branch = true
|
||||||
|
parallel = true
|
||||||
|
concurrency = multiprocessing
|
||||||
|
source =
|
||||||
|
src/ocrmypdf
|
||||||
|
|
||||||
|
[coverage:report]
|
||||||
|
# Regexes for lines to exclude from consideration
|
||||||
|
exclude_lines =
|
||||||
|
# Have to re-enable the standard pragma
|
||||||
|
pragma: no cover
|
||||||
|
|
||||||
|
# Don't complain if tests don't hit defensive assertion code:
|
||||||
|
raise AssertionError
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
# Don't complain if non-runnable code isn't run:
|
||||||
|
if 0:
|
||||||
|
if False:
|
||||||
|
if __name__ == .__main__.:
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
|||||||
@@ -338,6 +338,8 @@ def run_pipeline(options, *, plugin_manager, api=False):
|
|||||||
and not api
|
and not api
|
||||||
):
|
):
|
||||||
# Debug log for command line interface only with verbose output
|
# Debug log for command line interface only with verbose output
|
||||||
|
# See https://github.com/pytest-dev/pytest/issues/5502 for why we skip this
|
||||||
|
# when pytest is running
|
||||||
debug_log_handler = configure_debug_logging(Path(work_folder) / "debug.log")
|
debug_log_handler = configure_debug_logging(Path(work_folder) / "debug.log")
|
||||||
|
|
||||||
pikepdf_enable_mmap()
|
pikepdf_enable_mmap()
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ def transcode_pngs(
|
|||||||
|
|
||||||
|
|
||||||
@deprecated
|
@deprecated
|
||||||
def rewrite_png_as_g4(pike: Pdf, im_obj: Object, compdata) -> None:
|
def rewrite_png_as_g4(pike: Pdf, im_obj: Object, compdata) -> None: # pragma: no cover
|
||||||
im_obj.BitsPerComponent = 1
|
im_obj.BitsPerComponent = 1
|
||||||
im_obj.Width = compdata.w
|
im_obj.Width = compdata.w
|
||||||
im_obj.Height = compdata.h
|
im_obj.Height = compdata.h
|
||||||
@@ -519,7 +519,7 @@ def rewrite_png_as_g4(pike: Pdf, im_obj: Object, compdata) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@deprecated
|
@deprecated
|
||||||
def rewrite_png(pike: Pdf, im_obj: Object, compdata) -> None:
|
def rewrite_png(pike: Pdf, im_obj: Object, compdata) -> None: # pragma: no cover
|
||||||
# When a PNG is inserted into a PDF, we more or less copy the IDAT section from
|
# When a PNG is inserted into a PDF, we more or less copy the IDAT section from
|
||||||
# the PDF and transfer the rest of the PNG headers to PDF image metadata.
|
# the PDF and transfer the rest of the PNG headers to PDF image metadata.
|
||||||
# One thing we have to do is tell the PDF reader whether a predictor was used
|
# One thing we have to do is tell the PDF reader whether a predictor was used
|
||||||
|
|||||||
@@ -77,20 +77,19 @@ def run_polling_stderr(args, *, callback, check=False, env=None, **kwargs):
|
|||||||
args, env, process_log, text = _fix_process_args(args, env, kwargs)
|
args, env, process_log, text = _fix_process_args(args, env, kwargs)
|
||||||
assert text, "Must use text=True"
|
assert text, "Must use text=True"
|
||||||
|
|
||||||
proc = Popen(args, env=env, **kwargs)
|
with Popen(args, env=env, **kwargs) as proc:
|
||||||
|
lines = []
|
||||||
|
while proc.poll() is None:
|
||||||
|
for msg in iter(proc.stderr.readline, ''):
|
||||||
|
if process_log.isEnabledFor(logging.DEBUG):
|
||||||
|
process_log.debug(msg.strip())
|
||||||
|
callback(msg)
|
||||||
|
lines.append(msg)
|
||||||
|
stderr = ''.join(lines)
|
||||||
|
|
||||||
lines = []
|
if check and proc.returncode != 0:
|
||||||
while proc.poll() is None:
|
raise CalledProcessError(proc.returncode, args, output=None, stderr=stderr)
|
||||||
for msg in iter(proc.stderr.readline, ''):
|
return CompletedProcess(args, proc.returncode, None, stderr=stderr)
|
||||||
if process_log.isEnabledFor(logging.DEBUG):
|
|
||||||
process_log.debug(msg.strip())
|
|
||||||
callback(msg)
|
|
||||||
lines.append(msg)
|
|
||||||
stderr = ''.join(lines)
|
|
||||||
|
|
||||||
if check and proc.returncode != 0:
|
|
||||||
raise CalledProcessError(proc.returncode, args, output=None, stderr=stderr)
|
|
||||||
return CompletedProcess(args, proc.returncode, None, stderr=stderr)
|
|
||||||
|
|
||||||
|
|
||||||
def _fix_process_args(args, env, kwargs):
|
def _fix_process_args(args, env, kwargs):
|
||||||
|
|||||||
@@ -137,16 +137,7 @@ def run_ocrmypdf(input_file, output_file, *args, text=True):
|
|||||||
+ [str(input_file), str(output_file)]
|
+ [str(input_file), str(output_file)]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Tell subprocess where to find coverage.py configuration
|
|
||||||
# This has no unless except when coverage is running
|
|
||||||
# Details: https://coverage.readthedocs.io/en/coverage-5.0/subprocess.html
|
|
||||||
coverage_rc = Path(__file__).parent.parent / '.coveragerc'
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
if coverage_rc.exists():
|
|
||||||
env['COVERAGE_PROCESS_START'] = os.fspath(coverage_rc)
|
|
||||||
elif not running_in_docker():
|
|
||||||
assert False, "could not find .coveragerc"
|
|
||||||
|
|
||||||
p = run(
|
p = run(
|
||||||
p_args,
|
p_args,
|
||||||
stdout=PIPE,
|
stdout=PIPE,
|
||||||
|
|||||||
Reference in New Issue
Block a user