-
Notifications
You must be signed in to change notification settings - Fork 24
/
setup.py
83 lines (71 loc) · 2.5 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import os
import sys
from setuptools import setup, Extension
if sys.version_info < (3, 5):
raise SystemError("This package is for Python 3.5 and above.")
here = os.path.dirname(__file__)
# Get the long description from the README file
with open(os.path.join(here, "README.md"), encoding="utf-8") as fp:
long_description = fp.read()
setup_kwargs = {}
ext_files = [
"src/mmapbitarray.c",
"src/bloomfilter.c",
"src/md5.c",
"src/primetester.c",
"src/MurmurHash3.c",
]
# Branch out based on `--cython` in `argv`. Specifying `--cython` will try to cythonize source whether
# Cython module is available or not (`force_cythonize`).
cythonize = True
force_cythonize = False
if "--cython" in sys.argv:
force_cythonize = True
sys.argv.remove("--cython")
# Always try to cythonize `pybloomfilter.pyx` if Cython is available
# or if `--cython` was passed
try:
from Cython.Distutils import build_ext
except ModuleNotFoundError:
if force_cythonize:
print(
"Cannot Cythonize: Cython module not found. "
"Hint: to build pybloomfilter using the distributed "
"source code, simply run 'python setup.py install'."
)
sys.exit(1)
cythonize = False
if cythonize:
ext_files.append("src/pybloomfilter.pyx")
setup_kwargs["cmdclass"] = {"build_ext": build_ext}
else:
# Use `pybloomfilter.c` distributed with the package.
# Note that we let the exception bubble up if `pybloomfilter.c` doesn't exist.
ext_files.append("src/pybloomfilter.c")
ext_modules = [Extension("pybloomfilter", ext_files)]
setup(
name="pybloomfiltermmap3",
version="0.6.0",
author="Prashant Sinha",
author_email="prashant@noop.pw",
url="https://github.com/prashnts/pybloomfiltermmap3",
description="A fast implementation of Bloom filter for Python 3 built on mmap",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT License",
test_suite="tests.test_all",
ext_modules=ext_modules,
python_requires=">=3.5, <4",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: C",
"Programming Language :: Cython",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries :: Python Modules",
],
**setup_kwargs
)