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 ♥
This commit is contained in:
parent
1e9906de29
commit
f44769df41
@ -7,6 +7,7 @@ import re
|
|||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
import io
|
import io
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
import cairo
|
import cairo
|
||||||
import gi
|
import gi
|
||||||
@ -17,6 +18,11 @@ from . import abstract
|
|||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
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):
|
class PDFParser(abstract.AbstractParser):
|
||||||
mimetypes = {'application/pdf', }
|
mimetypes = {'application/pdf', }
|
||||||
|
4
mat2
4
mat2
@ -8,7 +8,11 @@ import mimetypes
|
|||||||
import argparse
|
import argparse
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
||||||
|
try:
|
||||||
from libmat2 import parser_factory, unsupported_extensions
|
from libmat2 import parser_factory, unsupported_extensions
|
||||||
|
except ValueError as e:
|
||||||
|
print(e)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
__version__ = '0.1.2'
|
__version__ = '0.1.2'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user