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
|
import os
import sys
here = os.path.dirname(__file__)
ext_files = ["src/mmapbitarray.c",
"src/bloomfilter.c",
"src/md5.c",
"src/primetester.c",
]
kwargs = {}
try:
if '--no-cython' in sys.argv:
raise ImportError()
import Cython
sys.path.insert(0, os.path.join(here, 'fake_pyrex'))
except ImportError:
pass
from setuptools import setup, Extension
try:
if '--no-cython' in sys.argv:
sys.argv.remove('--no-cython')
raise ImportError()
from Cython.Distutils import build_ext
print "info: Building from Cython"
ext_files.append("src/pybloomfilter.pyx")
kwargs['cmdclass'] = {'build_ext': build_ext}
try:
os.unlink(os.path.join(here, 'src', 'pybloomfilter.c'))
os.unlink(os.path.join(here, 'pybloomfilter.so'))
except:
pass
except ImportError:
if '--cython' in sys.argv:
raise
ext_files.append("src/pybloomfilter.c")
print "info: Building from C"
if '--cython' in sys.argv:
sys.argv.remove('--cython')
ext_modules = [Extension("pybloomfilter",
ext_files,
libraries=['crypto'])]
requirements = []
if sys.version_info[0] < 3 and sys.version_info[1] < 7:
requirements.append('importlib')
setup(
name = 'pybloomfiltermmap',
version = "0.3.11",
author = "Michael Axiak, Rob Stacey",
author_email = "mike@axiak.net",
url = "http://github.com/axiak/pybloomfiltermmap/",
description = "A Bloom filter (bloomfilter) for Python built on mmap",
license = "MIT License",
test_suite = 'tests.test_all',
install_requires=requirements,
ext_modules = ext_modules,
classifiers = [
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: C',
'Programming Language :: Cython',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
],
**kwargs
)
|