|
| 1 | +from distutils.core import setup, Extension |
| 2 | +import sys, os |
| 3 | + |
| 4 | +# check the platform |
| 5 | +if sys.platform.startswith('linux'): |
| 6 | + module = Extension('fitz._fitz', # name of the module |
| 7 | + ['fitz/fitz_wrap.c'], # C source file |
| 8 | + include_dirs=[ # we need the path of the MuPDF and zlib headers |
| 9 | + '/data/include/mupdf', |
| 10 | + '/data/local/include/mupdf', |
| 11 | + '/data/local/thirdparty/zlib', |
| 12 | + ], |
| 13 | + #library_dirs=['/usr/local/lib'], |
| 14 | + libraries=[ |
| 15 | + 'mupdf', |
| 16 | + 'mupdf-third', |
| 17 | + # 'jbig2dec', 'openjp2', 'jpeg', 'freetype', |
| 18 | + # 'crypto', #openssl is required by mupdf on archlinux |
| 19 | + ], # the libraries to link with |
| 20 | + ) |
| 21 | +elif sys.platform.startswith(('darwin', 'freebsd')): |
| 22 | + module = Extension('fitz._fitz', # name of the module |
| 23 | + ['fitz/fitz_wrap.c'], # C source file |
| 24 | + # this are directories containing mupdf's and zlib's header files |
| 25 | + include_dirs=['/data/local/include/mupdf', |
| 26 | + '/data/local/include', |
| 27 | + '/udatasr/local/thirdparty/zlib'], |
| 28 | + library_dirs=['/data/local/lib'], |
| 29 | + libraries=['mupdf', 'mupdf-third'] |
| 30 | + ) |
| 31 | + |
| 32 | +else: |
| 33 | +#=============================================================================== |
| 34 | +# This will build / set up PyMuPDF under Windows. |
| 35 | +# For details consult the documentation. |
| 36 | +#=============================================================================== |
| 37 | + module = Extension('fitz._fitz', |
| 38 | + include_dirs=[ # we need the path of the MuPDF's headers |
| 39 | + './mupdf/include', |
| 40 | + './mupdf/include/mupdf', |
| 41 | + './mupdf/thirdparty/zlib', |
| 42 | + ], |
| 43 | + libraries=[ # these are needed in Windows |
| 44 | + 'libmupdf', 'libresources', |
| 45 | + 'libthirdparty', |
| 46 | + ], |
| 47 | + extra_link_args=['/NODEFAULTLIB:MSVCRT'], |
| 48 | + # x86 dir of libmupdf.lib etc. |
| 49 | + library_dirs=['./mupdf/platform/win32/Release'], |
| 50 | + # x64 dir of libmupdf.lib etc. |
| 51 | + #library_dirs=['./mupdf/platform/win32/x64/Release'], |
| 52 | + sources=['./fitz/fitz_wrap.c',]) |
| 53 | + |
| 54 | +setup(name = 'PyMuPDF', |
| 55 | + version = "1.14.3", |
| 56 | + description = 'Python bindings for the PDF rendering library MuPDF', |
| 57 | + classifiers = ['Development Status :: 5 - Production/Stable', |
| 58 | + 'Environment :: Console', |
| 59 | + 'Intended Audience :: Developers', |
| 60 | + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', |
| 61 | + 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', |
| 62 | + 'Operating System :: Microsoft :: Windows', |
| 63 | + 'Operating System :: POSIX :: Linux', |
| 64 | + 'Operating System :: MacOS', |
| 65 | + 'Programming Language :: C', |
| 66 | + 'Programming Language :: Python :: 2.7', |
| 67 | + 'Programming Language :: Python :: 3', |
| 68 | + 'Topic :: Utilities'], |
| 69 | + url = 'https://github.com/rk700/PyMuPDF', |
| 70 | + author = 'Ruikai Liu, Jorj McKie', |
| 71 | + author_email = '[email protected]', |
| 72 | + license = 'GPLv3+', |
| 73 | + ext_modules = [module], |
| 74 | + py_modules = ['fitz.fitz', 'fitz.utils']) |
0 commit comments