Skip to content

Commit

Permalink
Handle incompatible jbig2.exe from TeX Live
Browse files Browse the repository at this point in the history
Fixes #1363
  • Loading branch information
jbarlow83 committed Jul 27, 2024
1 parent fbaad57 commit 39010dd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/ocrmypdf/_exec/jbig2enc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from __future__ import annotations

from subprocess import PIPE
from subprocess import PIPE, CalledProcessError

from packaging.version import Version

Expand All @@ -14,7 +14,13 @@


def version() -> Version:
return Version(get_version('jbig2', regex=r'jbig2enc (\d+(\.\d+)*).*'))
try:
version = get_version('jbig2', regex=r'jbig2enc (\d+(\.\d+)*).*')
except CalledProcessError as e:
# TeX Live for Windows provides an incompatible jbig2.EXE which may
# be on the PATH.
raise MissingDependencyError('jbig2enc') from e
return Version(version)


def available():
Expand Down

0 comments on commit 39010dd

Please sign in to comment.