-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from mizvyt/master
Re-add compilation from C (resolves #8)
- Loading branch information
Showing
3 changed files
with
69 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cython==0.29.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,65 +3,71 @@ | |
|
||
from setuptools import setup, Extension | ||
|
||
try: | ||
from Cython.Distutils import build_ext | ||
except ImportError: | ||
print("""Cannot find Cython! | ||
Cython is required to correctly build pyBloomFilter's C extensions. | ||
In most cases, running the following command should be sufficient: | ||
$ pip install Cython | ||
Exception: ImportError | ||
""") | ||
exit() | ||
if sys.version_info[0] < 3: | ||
raise SystemError("This package is for Python version 3 and above.") | ||
|
||
here = os.path.dirname(__file__) | ||
|
||
# Get the long description from the README file | ||
with open(os.path.join(here, 'README.markdown'), encoding='utf-8') as fp: | ||
long_description = fp.read() | ||
with open(os.path.join(here, "README.markdown"), 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', | ||
'src/pybloomfilter.pyx' | ||
"src/mmapbitarray.c", | ||
"src/bloomfilter.c", | ||
"src/md5.c", | ||
"src/primetester.c", | ||
"src/MurmurHash3.c", | ||
] | ||
|
||
print("info: Building from Cython") | ||
# Branch out based on `--no-cython` in `argv`. | ||
# Assume `--cython` as default to avoid having to deal with both params being there. | ||
|
||
ext_modules = [ | ||
Extension("pybloomfilter", ext_files, libraries=['crypto']) | ||
] | ||
if "--no-cython" in sys.argv: | ||
# Use the distributed `pybloomfilter.c`. | ||
# Note that we let the exception bubble up if `pybloomfilter.c` doesn't exist. | ||
ext_files.append("src/pybloomfilter.c") | ||
sys.argv.remove("--no-cython") | ||
else: | ||
# Cythonize `pybloomfilter.pyx` | ||
try: | ||
from Cython.Distutils import build_ext | ||
except ModuleNotFoundError: | ||
print( | ||
"Cython module not found. Hint: to build pybloomfilter using the distributed " | ||
"source code, run 'python setup.py install --no-cython'." | ||
) | ||
sys.exit(1) | ||
|
||
if sys.version_info[0] < 3: | ||
raise SystemError('This Package is for Python Version 3 and above.') | ||
ext_files.append("src/pybloomfilter.pyx") | ||
setup_kwargs["cmdclass"] = {"build_ext": build_ext} | ||
|
||
ext_modules = [Extension("pybloomfilter", ext_files)] | ||
|
||
setup( | ||
name='pybloomfiltermmap3', | ||
version="0.4.19", | ||
author="Michael Axiak, Rob Stacey, Prashant Sinha", | ||
author_email="[email protected]", | ||
url="https://github.com/prashnts/pybloomfiltermmap3", | ||
description="A Bloom filter (bloomfilter) for Python 3 built on mmap", | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
license="MIT License", | ||
test_suite='tests.test_all', | ||
install_requires=['Cython'], | ||
ext_modules=ext_modules, | ||
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', | ||
], | ||
cmdclass={'build_ext': build_ext} | ||
name="pybloomfiltermmap3", | ||
version="0.4.19", | ||
author="Michael Axiak, Rob Stacey, Prashant Sinha", | ||
author_email="[email protected]", | ||
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, | ||
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 | ||
) |