Commit f44769df authored by jvoisin's avatar jvoisin
Browse files

Ensure Poppler's minimal version

We're using methods that aren't available in Poppler
below 0.46, so we're checking for this upon import.

This commit is based on ideas from @LogicalDash 
parent 1e9906de
Pipeline #16186 passed with stages
in 3 minutes and 12 seconds
......@@ -7,6 +7,7 @@ import re
import logging
import tempfile
import io
from distutils.version import LooseVersion
import cairo
import gi
......@@ -17,6 +18,11 @@ from . import abstract
logging.basicConfig(level=logging.DEBUG)
poppler_version = Poppler.get_version()
if LooseVersion(poppler_version) < LooseVersion('0.46'):
raise ValueError("MAT2 needs at least Poppler version 0.46 to work. \
The installed version is %s." % poppler_version)
class PDFParser(abstract.AbstractParser):
mimetypes = {'application/pdf', }
......
......@@ -8,7 +8,11 @@ import mimetypes
import argparse
import multiprocessing
from libmat2 import parser_factory, unsupported_extensions
try:
from libmat2 import parser_factory, unsupported_extensions
except ValueError as e:
print(e)
sys.exit(1)
__version__ = '0.1.2'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment