-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
147 lines (131 loc) · 4.03 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import io
import os
import re
import sys
from setuptools import Extension
from setuptools import find_packages
from setuptools import setup
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
_dev_build = "--inplace" in sys.argv
_ci_build = "egg_info" in sys.argv or "install" in sys.argv
_define_macros = []
_extra_cargs = []
if int(os.getenv("FOR_PRODUCTION", "0")) == 1:
_dev_build = False
_ci_build = False
# _extra_cargs.append("-O2")
# _extra_cargs.append("-ffloat-store")
# _extra_cargs.append("-fgcse")
# _extra_cargs.append("-floop-parallelize-all")
# _extra_cargs.append("-fivopts")
# _extra_cargs.append("-freorder-blocks-and-partition")
# _extra_cargs.append("-foptimize-sibling-calls")
# _extra_cargs.append("-freorder-functions")
# _extra_cargs.append("-ftree-vectorize")
_extra_cargs.append("-O3")
# _extra_cargs.append("-foptimize-strlen")
_extra_cargs.append("-ffloat-store")
_extra_cargs.append("-fpartial-inlining")
# _extra_cargs.append("-fgcse")
# _extra_cargs.append("-fivopts")
_extra_cargs.append("-freorder-blocks-and-partition")
_extra_cargs.append("-foptimize-sibling-calls")
_extra_cargs.append("-freorder-functions")
_extra_cargs.append("-flto")
else:
_extra_cargs.append("-Og")
_define_macros += [
("CYTHON_PROFILE", 1),
("CYTHON_TRACE", 1),
("CYTHON_TRACE_NOGIL", 1),
]
def read(*names, **kwargs):
return io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8"),
).read()
ext_modules = [
Extension(
"xrtr",
sources=["src/xrtr.{}".format("c" if _ci_build else "pyx")],
extra_compile_args=_extra_cargs,
define_macros=_define_macros,
)
]
cy_modules = None
if cythonize is not None:
cy_modules = cythonize(
ext_modules,
compiler_directives={
"optimize.use_switch": False,
"optimize.unpack_method_calls": False,
"language_level": 3,
"c_string_type": "bytes",
"c_string_encoding": "ascii",
"boundscheck": False,
"wraparound": False,
"embedsignature": _dev_build,
"linetrace": _dev_build,
"profile": _dev_build,
"binding": _dev_build,
},
)
setup(
name="xrtr",
version="0.2.1",
description="A Radix Tree based router for HTTP and other routing needs "
"with support for middlewares and endpoints with a Cython "
"boost",
long_description="%s\n%s"
% (
re.compile("^.. start-badges.*^.. end-badges", re.M | re.S).sub(
"", read("README.rst")
),
re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.rst")),
),
author="Richard Kuesters",
author_email="[email protected]",
url="https://github.com/vltr/xrtr",
setup_requires=["Cython"],
install_requires=["setuptools>=19.0"],
ext_modules=cy_modules,
package_data={
"xrtr": [
"src/xrtr.pyx",
"src/xrtr.c",
"src/__init__.py",
"src/__init__.pxd",
]
},
packages=find_packages("src"),
package_dir={"": "src"},
zip_safe=False,
python_requires=">=3.5",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: Unix",
"Operating System :: POSIX",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython",
# 'Programming Language :: Python :: Implementation :: PyPy',
"Topic :: Utilities",
],
keywords=[
"router",
"radix",
"tree",
"cython",
"trie",
"middleware",
"endpoint",
],
)