forked from TkTech/pysimdjson
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
119 lines (106 loc) · 3.02 KB
/
setup.py
File metadata and controls
119 lines (106 loc) · 3.02 KB
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
import os.path
import platform
from setuptools import setup, find_packages, Extension
try:
from Cython.Build import cythonize
except ImportError:
CYTHON_AVAILABLE = False
else:
CYTHON_AVAILABLE = True
root = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(root, 'README.md'), 'rb') as readme:
long_description = readme.read().decode('utf-8')
system = platform.system()
extra_compile_args = []
if system == 'Darwin':
extra_compile_args.append('-std=c++11')
if os.getenv('BUILD_WITH_CYTHON') and not CYTHON_AVAILABLE:
print(
'BUILD_WITH_CYTHON environment variable is set, but cython'
' is not available. Falling back to pre-cythonized version if'
' available.'
)
if os.getenv('BUILD_WITH_CYTHON') and CYTHON_AVAILABLE:
macros = []
compiler_directives = {
'embedsignature': True
}
if os.getenv('BUILD_FOR_DEBUG'):
# Enable line tracing, which also enables support for coverage
# reporting.
macros = [
('CYTHON_TRACE', 1),
('CYTHON_TRACE_NOGIL', 1)
]
compiler_directives['linetrace'] = True
force = bool(os.getenv('FORCE_REBUILD'))
extensions = cythonize([
Extension(
'csimdjson',
[
'simdjson/simdjson.cpp',
'simdjson/util.cpp',
'simdjson/csimdjson.pyx'
],
define_macros=macros,
extra_compile_args=extra_compile_args
)
], compiler_directives=compiler_directives, force=force)
else:
extensions = [
Extension(
'csimdjson',
[
'simdjson/simdjson.cpp',
'simdjson/util.cpp',
'simdjson/csimdjson.cpp'
],
extra_compile_args=extra_compile_args,
language='c++'
)
]
setup(
name='pysimdjson',
packages=find_packages(),
version='5.0.1',
description='simdjson bindings for python',
long_description=long_description,
long_description_content_type='text/markdown',
author='Tyler Kennedy',
author_email='tk@tkte.ch',
url='https://github.com/TkTech/pysimdjson',
keywords=['json', 'simdjson', 'simd'],
zip_safe=False,
classifiers=[
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
],
python_requires='>3.5',
extras_require={
# Dependencies for package release.
'release': [
'sphinx',
'furo',
'ghp-import',
'bumpversion'
],
# Dependencies for running tests.
'test': [
'pytest',
'pytest-benchmark',
'flake8',
'coverage'
]
},
ext_modules=extensions,
package_data={
'simdjson': [
'simdjson/*.pxd',
'__init__.pyi',
'py.typed'
]
}
)