Skip to content

Commit 47f8d6d

Browse files
authored
Merge pull request #236 from fsecada01/master
Special setup file for specialty linux builds (e.g.: linux in Nanobox)
2 parents 5c88727 + 8785307 commit 47f8d6d

File tree

2 files changed

+96
-16
lines changed

2 files changed

+96
-16
lines changed

nano_setup.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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'])

setup.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'/usr/local/include/mupdf',
1111
'/usr/local/thirdparty/zlib',
1212
],
13-
#library_dirs=['/usr/local/lib'],
13+
#library_dirs=['<mupdf_and_3rd_party_libraries_dir>'],
1414
libraries=[
1515
'mupdf',
1616
'mupdf-third',
@@ -22,10 +22,15 @@
2222
module = Extension('fitz._fitz', # name of the module
2323
['fitz/fitz_wrap.c'], # C source file
2424
# this are directories containing mupdf's and zlib's header files
25-
include_dirs=['/usr/local/include/mupdf',
26-
'/usr/local/include',
27-
'/usr/local/thirdparty/zlib'],
25+
include_dirs=['/usr/local/include/mupdf', '/usr/local/include'],
26+
# libraries should already be linked here by brew
2827
library_dirs=['/usr/local/lib'],
28+
#library_dirs=['/usr/local/Cellar/mupdf-tools/1.8/lib/',
29+
#'/usr/local/Cellar/openssl/1.0.2g/lib/',
30+
#'/usr/local/Cellar/jpeg/8d/lib/',
31+
#'/usr/local/Cellar/freetype/2.6.3/lib/',
32+
#'/usr/local/Cellar/jbig2dec/0.12/lib/'
33+
#],
2934
libraries=['mupdf', 'mupdf-third']
3035
)
3136

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

59+
pkg_tab = open("PKG-INFO").read().split("\n")
60+
long_dtab = []
61+
classifier = []
62+
for l in pkg_tab:
63+
if l.startswith("Classifier: "):
64+
classifier.append(l[12:])
65+
continue
66+
if l.startswith(" "):
67+
long_dtab.append(l.strip())
68+
long_desc = "\n".join(long_dtab)
69+
5470
setup(name = 'PyMuPDF',
5571
version = "1.14.3",
5672
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'],
73+
long_description = long_desc,
74+
classifiers = classifier,
6975
url = 'https://github.com/rk700/PyMuPDF',
7076
author = 'Ruikai Liu, Jorj McKie',
7177
author_email = '[email protected]',

0 commit comments

Comments
 (0)