Skip to content

Commit

Permalink
Merge pull request #236 from fsecada01/master
Browse files Browse the repository at this point in the history
Special setup file for specialty linux builds (e.g.: linux in Nanobox)
  • Loading branch information
JorjMcKie committed Dec 11, 2018
2 parents 5c88727 + 8785307 commit 47f8d6d
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 16 deletions.
74 changes: 74 additions & 0 deletions nano_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
from distutils.core import setup, Extension
import sys, os

# check the platform
if sys.platform.startswith('linux'):
module = Extension('fitz._fitz', # name of the module
['fitz/fitz_wrap.c'], # C source file
include_dirs=[ # we need the path of the MuPDF and zlib headers
'/data/include/mupdf',
'/data/local/include/mupdf',
'/data/local/thirdparty/zlib',
],
#library_dirs=['/usr/local/lib'],
libraries=[
'mupdf',
'mupdf-third',
# 'jbig2dec', 'openjp2', 'jpeg', 'freetype',
# 'crypto', #openssl is required by mupdf on archlinux
], # the libraries to link with
)
elif sys.platform.startswith(('darwin', 'freebsd')):
module = Extension('fitz._fitz', # name of the module
['fitz/fitz_wrap.c'], # C source file
# this are directories containing mupdf's and zlib's header files
include_dirs=['/data/local/include/mupdf',
'/data/local/include',
'/udatasr/local/thirdparty/zlib'],
library_dirs=['/data/local/lib'],
libraries=['mupdf', 'mupdf-third']
)

else:
#===============================================================================
# This will build / set up PyMuPDF under Windows.
# For details consult the documentation.
#===============================================================================
module = Extension('fitz._fitz',
include_dirs=[ # we need the path of the MuPDF's headers
'./mupdf/include',
'./mupdf/include/mupdf',
'./mupdf/thirdparty/zlib',
],
libraries=[ # these are needed in Windows
'libmupdf', 'libresources',
'libthirdparty',
],
extra_link_args=['/NODEFAULTLIB:MSVCRT'],
# x86 dir of libmupdf.lib etc.
library_dirs=['./mupdf/platform/win32/Release'],
# x64 dir of libmupdf.lib etc.
#library_dirs=['./mupdf/platform/win32/x64/Release'],
sources=['./fitz/fitz_wrap.c',])

setup(name = 'PyMuPDF',
version = "1.14.3",
description = 'Python bindings for the PDF rendering library MuPDF',
classifiers = ['Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
'Programming Language :: C',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Utilities'],
url = 'https://github.com/rk700/PyMuPDF',
author = 'Ruikai Liu, Jorj McKie',
author_email = '[email protected]',
license = 'GPLv3+',
ext_modules = [module],
py_modules = ['fitz.fitz', 'fitz.utils'])
38 changes: 22 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'/usr/local/include/mupdf',
'/usr/local/thirdparty/zlib',
],
#library_dirs=['/usr/local/lib'],
#library_dirs=['<mupdf_and_3rd_party_libraries_dir>'],
libraries=[
'mupdf',
'mupdf-third',
Expand All @@ -22,10 +22,15 @@
module = Extension('fitz._fitz', # name of the module
['fitz/fitz_wrap.c'], # C source file
# this are directories containing mupdf's and zlib's header files
include_dirs=['/usr/local/include/mupdf',
'/usr/local/include',
'/usr/local/thirdparty/zlib'],
include_dirs=['/usr/local/include/mupdf', '/usr/local/include'],
# libraries should already be linked here by brew
library_dirs=['/usr/local/lib'],
#library_dirs=['/usr/local/Cellar/mupdf-tools/1.8/lib/',
#'/usr/local/Cellar/openssl/1.0.2g/lib/',
#'/usr/local/Cellar/jpeg/8d/lib/',
#'/usr/local/Cellar/freetype/2.6.3/lib/',
#'/usr/local/Cellar/jbig2dec/0.12/lib/'
#],
libraries=['mupdf', 'mupdf-third']
)

Expand All @@ -51,21 +56,22 @@
#library_dirs=['./mupdf/platform/win32/x64/Release'],
sources=['./fitz/fitz_wrap.c',])

pkg_tab = open("PKG-INFO").read().split("\n")
long_dtab = []
classifier = []
for l in pkg_tab:
if l.startswith("Classifier: "):
classifier.append(l[12:])
continue
if l.startswith(" "):
long_dtab.append(l.strip())
long_desc = "\n".join(long_dtab)

setup(name = 'PyMuPDF',
version = "1.14.3",
description = 'Python bindings for the PDF rendering library MuPDF',
classifiers = ['Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
'Programming Language :: C',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Utilities'],
long_description = long_desc,
classifiers = classifier,
url = 'https://github.com/rk700/PyMuPDF',
author = 'Ruikai Liu, Jorj McKie',
author_email = '[email protected]',
Expand Down

0 comments on commit 47f8d6d

Please sign in to comment.