|
34 | 34 | from setuptools import setup, Extension |
35 | 35 | from Cython.Build import cythonize |
36 | 36 |
|
37 | | - |
38 | | -PACKAGE_NAME = "libzim_wrapper" |
39 | | -VERSION = "0.0.1" # pegged to be the same version as libzim since they are always released together |
40 | | -LICENSE = "GPLv3+" |
41 | | -DESCRIPTION = "A python-facing API for creating and interacting with ZIM files" |
42 | | -AUTHOR = "Monadical Inc." |
43 | | -AUTHOR_EMAIL = "[email protected]" |
44 | 37 | GITHUB_URL = "https://github.com/openzim/python-libzim" |
45 | | - |
46 | 38 | BASE_DIR = Path(__file__).parent |
47 | | -BINDINGS_CYTHON_DIR = 'libzim' # the cython binding source dir (containing .pyx, .pyd, etc.) |
48 | 39 | LIBZIM_INCLUDE_DIR = 'include' # the libzim C++ header src dir (containing zim/*.h) |
49 | 40 | LIBZIM_LIBRARY_DIR = 'lib' # the libzim .so binary lib dir (containing libzim.so) |
50 | 41 |
|
|
55 | 46 | f"[!] Warning: Couldn't find zim/*.h in ./{LIBZIM_INCLUDE_DIR}!\n" |
56 | 47 | f" Hint: You can install them from source from https://github.com/openzim/libzim\n" |
57 | 48 | f" or download a prebuilt release's headers into ./include/zim/*.h\n" |
58 | | - f" (or set CFLAGS='-I/tmp/libzim_linux-x86_64-{VERSION}/include')" |
| 49 | + f" (or set CFLAGS='-I<library_path>/include')" |
59 | 50 | ) |
60 | 51 |
|
61 | 52 | # Check for the CPP Libzim shared library in expected directory or system paths |
|
64 | 55 | f"[!] Warning: Couldn't find libzim.so in ./{LIBZIM_LIBRARY_DIR} or system library paths!" |
65 | 56 | f" Hint: You can install it from source from https://github.com/openzim/libzim\n" |
66 | 57 | f" or download a prebuilt zimlib.so release into ./lib.\n" |
67 | | - f" (or set LDFLAGS='-L/tmp/libzim_linux-x86_64-{VERSION}/lib/x86_64-linux-gnu')" |
| 58 | + f" (or set LDFLAGS='-L<library_path>/lib/x86_64-linux-gnu')" |
68 | 59 | ) |
69 | 60 |
|
| 61 | +def get_long_description(): |
| 62 | + return (BASE_DIR/'README.md').read_text() |
| 63 | + |
| 64 | +wrapper_extension = Extension( |
| 65 | + name = "libzim_wrapper", |
| 66 | + sources = ["libzim/*.pyx", "libzim/lib.cxx"], |
| 67 | + include_dirs=["libzim", LIBZIM_INCLUDE_DIR], |
| 68 | + libraries=['zim'], |
| 69 | + library_dirs=[LIBZIM_LIBRARY_DIR], |
| 70 | + extra_compile_args=["-std=c++11", "-Wall", "-Wextra"], |
| 71 | + language="c++", |
| 72 | +) |
| 73 | + |
| 74 | + |
70 | 75 | setup( |
71 | | - name=PACKAGE_NAME, |
72 | | - version=VERSION, |
| 76 | +# Basic information about libzim module |
| 77 | + name="libzim", |
| 78 | + version="0.0.1", |
73 | 79 | url=GITHUB_URL, |
74 | 80 | project_urls={ |
75 | 81 | 'Source': GITHUB_URL, |
|
78 | 84 | 'Documentation': f'{GITHUB_URL}/blob/master/README.md', |
79 | 85 | 'Donate': 'https://www.kiwix.org/en/support-us/', |
80 | 86 | }, |
81 | | - author=AUTHOR, |
82 | | - author_email=AUTHOR_EMAIL, |
83 | | - license=LICENSE, |
84 | | - description=DESCRIPTION, |
85 | | - long_description=(BASE_DIR / 'README.md').read_text(), |
| 87 | + author="Monadical Inc.", |
| 88 | + |
| 89 | + license="GPLv3+", |
| 90 | + description="A python-facing API for creating and interacting with ZIM files", |
| 91 | + long_description=get_long_description(), |
86 | 92 | long_description_content_type="text/markdown", |
87 | 93 | python_requires='>=3.6', |
88 | | - include_package_data=True, |
89 | | - ext_modules=cythonize( |
90 | | - [ |
91 | | - Extension( |
92 | | - "libzim_wrapper", |
93 | | - sources=[ |
94 | | - f"{BINDINGS_CYTHON_DIR}/*.pyx", |
95 | | - f"{BINDINGS_CYTHON_DIR}/lib.cxx", |
96 | | - ], |
97 | | - include_dirs=[ |
98 | | - BINDINGS_CYTHON_DIR, |
99 | | - LIBZIM_INCLUDE_DIR, |
100 | | - ], |
101 | | - libraries=[ |
102 | | - 'zim', |
103 | | - ], |
104 | | - library_dirs=[ |
105 | | - LIBZIM_LIBRARY_DIR, |
106 | | - ], |
107 | | - extra_compile_args=[ |
108 | | - "-std=c++11", |
109 | | - "-Wall", |
110 | | - "-Wextra", |
111 | | - ], |
112 | | - language="c++", |
113 | | - ) |
114 | | - ], |
115 | | - compiler_directives={"language_level" : "3"}, |
| 94 | + |
| 95 | + # Content |
| 96 | + ext_modules=cythonize([wrapper_extension], |
| 97 | + compiler_directives={"language_level": "3"} |
116 | 98 | ), |
| 99 | + |
| 100 | +# Packaging |
| 101 | + include_package_data=True, |
117 | 102 | zip_safe=False, |
| 103 | + |
| 104 | +# Extra |
118 | 105 | classifiers=[ |
119 | 106 | "Development Status :: 3 - Alpha", |
120 | 107 |
|
|
0 commit comments