-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
executable file
·123 lines (102 loc) · 3.13 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import os
import subprocess
import sys
from setuptools import Extension, setup
def build_judy():
print('INFO: building judy static library...')
CC = os.environ.get('CC', 'cc')
is_clang = False
is_gcc_46 = False
# test if CC is clang/gcc-4.6
exitcode, output = subprocess.getstatusoutput('%s -v' % (CC,))
if exitcode != 0:
sys.exit(output)
if 'clang' in output:
print('INFO: compiler is Clang')
is_clang = True
elif 'gcc version 4.6' in output:
print('INFO: compiler is GCC 4.6')
is_gcc_46 = True
# adding last two flags because of compiler and/or code bugs
# see http://sourceforge.net/p/judy/mailman/message/32417284/
assert(sys.maxsize in (2**63 - 1, 2**31 - 1))
if is_clang or is_gcc_46:
if sys.maxsize == 2**63 - 1:
CFLAGS = '-DJU_64BIT -O0 -fPIC -fno-strict-aliasing'
else:
CFLAGS = ' -O0 -fPIC -fno-strict-aliasing'
else:
if sys.maxsize == 2**63 - 1:
CFLAGS = '-DJU_64BIT -O0 -fPIC -fno-strict-aliasing -fno-aggressive-loop-optimizations'
else:
CFLAGS = ' -O0 -fPIC -fno-strict-aliasing -fno-aggressive-loop-optimizations'
exitcode, output = subprocess.getstatusoutput('(cd judy-1.0.5/src; CC=\'%s\' COPT=\'%s\' sh ./sh_build)' % (CC, CFLAGS))
if exitcode != 0:
sys.exit(output)
print(output)
if not os.path.isfile('./judy-1.0.5/src/libJudy.a'):
build_judy()
extra_link_args = ['-L./judy-1.0.5/src', '-Bstatic', '-lJudy', '-Bdynamic', '-lm']
extra_compile_args = [
'-I./judy-1.0.5/src',
'-I./include',
'-I/usr/local/include',
'-Wall',
'-Wno-strict-prototypes',
'-g',
'-D_GNU_SOURCE',
'-O2',
'-DNDEBUG',
# '-fno-omit-frame-pointer',
# '-pg',
# '-fno-inline-functions',
# '-fno-inline-functions-called-once',
# '-fno-optimize-sibling-calls',
# '-fno-inline'
]
setup(
name='judy',
version='1.0.18',
maintainer='Arni Mar Jonsson',
maintainer_email='arnimarj@gmail.com',
description='A Python wrapper for Judy arrays, which provide fast and space-efficient integer mappings and integer sets, along with ranged ordered iterations',
url='https://github.com/arnimarj/py-judy/',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Other Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
'Operating System :: POSIX',
'Programming Language :: C',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Database',
'Topic :: Software Development :: Libraries'
],
packages=['judy'],
package_dir={'judy': 'src'},
package_data={
'judy': ['py.typed', '*.pyi'],
},
include_package_data=True,
ext_modules=[
Extension(
'_judy',
include_dirs=['./judy-1.0.5/src', './src-c'],
library_dirs=['./judy-1.0.5/src'],
sources=[
'src-c/judy.c',
'src-c/judy_int_object_map.c',
'src-c/judy_int_set.c',
'src-c/utils.c'
],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args
)
]
)