forked from andreasvc/roaringbitmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
81 lines (78 loc) · 2.16 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
"""Generic setup.py for Cython code."""
import os
import sys
from distutils.core import setup
from distutils.extension import Extension
USE_CYTHON = '--with-cython' in sys.argv or not os.path.exists(
'src/roaringbitmap.c')
if USE_CYTHON:
if '--with-cython' in sys.argv:
sys.argv.remove('--with-cython')
try:
from Cython.Build import cythonize
from Cython.Distutils import build_ext
except ImportError:
raise ValueError('could not import Cython.')
cmdclass = dict(build_ext=build_ext)
else:
cmdclass = dict()
metadata = dict(name='roaringbitmap',
version='0.3',
description='Roaring Bitmap',
long_description=open('README.rst').read(),
author='Andreas van Cranenburgh',
author_email='[email protected]',
url='https://github.com/andreasvc/roaringbitmap/',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: POSIX',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Cython',
],
)
# some of these directives increase performance,
# but at the cost of failing in mysterious ways.
directives = {
'profile': False,
'cdivision': True,
'fast_fail': True,
'nonecheck': False,
'wraparound': False,
'boundscheck': False,
'embedsignature': True,
'warn.unused': True,
'warn.unreachable': True,
'warn.maybe_uninitialized': True,
'warn.undeclared': False,
'warn.unused_arg': False,
'warn.unused_result': False,
}
if __name__ == '__main__':
os.environ['GCC_COLORS'] = 'auto'
if USE_CYTHON:
extensions = [Extension(
'*',
sources=['src/*.pyx'],
extra_compile_args=['-O3', '-DNDEBUG', '-march=native'],
# extra_compile_args=['-O0', '-g'],
# extra_link_args=['-g'],
)]
ext_modules = cythonize(
extensions,
annotate=True,
compiler_directives=directives,
language_level=3,
)
else:
ext_modules = [Extension(
'roaringbitmap',
sources=['src/roaringbitmap.c'],
extra_compile_args=['-O3', '-DNDEBUG', '-march=native'],
)]
setup(
cmdclass=cmdclass,
ext_modules=ext_modules,
**metadata)