-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
executable file
·58 lines (50 loc) · 1.83 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
from setuptools import Extension, setup
try:
from Cython.Build import cythonize
from Cython.Distutils import build_ext
except ImportError:
print('You need to install cython first - pip install cython',
file=sys.stderr)
sys.exit(1)
POPPLER_ROOT = os.environ.get('POPPLER_ROOT', '')
if not POPPLER_ROOT:
print('Please clone and compile poppler from source and set POPPLER_ROOT '
'environment variable. See README for more info.', file=sys.stderr)
sys.exit(1)
if sys.platform == 'darwin':
# OS X extras
extra_compile_args = [
"-std=c++11", "-stdlib=libc++", "-mmacosx-version-min=10.7"
]
else:
extra_compile_args = ["-std=c++11"]
POPPLER_CPP_LIB_DIR = os.path.join(POPPLER_ROOT, 'cpp/')
POPPLER_UTILS_DIR = os.path.join(POPPLER_ROOT, 'utils/')
poppler_ext = Extension('pdflib.poppler',
['pdflib/poppler.pyx',
os.path.join(POPPLER_UTILS_DIR, 'ImageOutputDev.cc')],
language='c++',
extra_compile_args=extra_compile_args,
include_dirs=[
POPPLER_ROOT, os.path.join(POPPLER_ROOT, 'poppler')
],
library_dirs=[POPPLER_ROOT, POPPLER_CPP_LIB_DIR],
libraries=['poppler', 'poppler-cpp'])
setup(
name='pdflib',
version='0.3.0',
description="python bindings for poppler",
author='Journalism Development Network',
author_email='data@occrp.org',
license='GPLv3',
url='http://github.com/alephdata/pdflib',
install_requires=['cython', 'lxml', 'six'],
packages=['pdflib'],
ext_modules=cythonize([poppler_ext]),
zip_safe=False,
cmdclass={'build_ext': build_ext},
)