Fix Python 3.5 pathlib regressions

This commit is contained in:
James R. Barlow
2018-11-10 02:11:23 -08:00
parent 755b5d87e3
commit cc7f2a3f02
3 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -21,6 +21,7 @@ from functools import lru_cache
from ..exceptions import InputFileError, SubprocessOutputError, \
EncryptedPdfError
from . import get_version
from ..helpers import fspath
@lru_cache(maxsize=1)
@@ -32,7 +33,7 @@ def check(input_file, log=None):
args_qpdf = [
'qpdf',
'--check',
input_file
fspath(input_file)
]
if log is None:
+2 -2
View File
@@ -25,7 +25,7 @@ from subprocess import CalledProcessError, TimeoutExpired, check_output, STDOUT,
from contextlib import suppress
from ..exceptions import MissingDependencyError, TesseractConfigError
from ..helpers import page_number
from ..helpers import page_number, fspath
from . import get_version
OrientationConfidence = namedtuple(
@@ -135,7 +135,7 @@ def tess_base_args(langs, engine_mode):
def get_orientation(input_file, engine_mode, timeout: float, log):
args_tesseract = tess_base_args(['osd'], engine_mode) + [
psm(), '0',
input_file,
fspath(input_file),
'stdout'
]
+3 -1
View File
@@ -25,6 +25,7 @@ import pytest
from PIL import Image, ImageChops
import ocrmypdf.leptonica as lept
from ocrmypdf.helpers import fspath
def test_colormap_backgroundnorm(resources):
@@ -86,4 +87,5 @@ def test_leptonica_compile(tmpdir):
# Compile the library but build it somewhere that won't interfere with
# existing compiled library. Also compile in API mode so that we test
# the interfaces, even though we use it ABI mode.
ffibuilder.compile(tmpdir=tmpdir, target=(tmpdir / 'lepttest.*'))
ffibuilder.compile(tmpdir=fspath(tmpdir),
target=fspath(tmpdir / 'lepttest.*'))