forked from tahoe-lafs/zfec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
70 lines (61 loc) · 1.97 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
from setuptools import setup
from setuptools.extension import Extension
import platform
import sys
import versioneer
DEBUGMODE = False
if "--debug" in sys.argv:
DEBUGMODE = True
sys.argv.remove("--debug")
extra_link_args = []
extra_compile_args = []
define_macros = []
undef_macros = []
for arg in sys.argv:
if arg.startswith("--stride="):
stride = int(arg[len("--stride="):])
define_macros.append(('STRIDE', stride))
sys.argv.remove(arg)
break
extra_compile_args.append("-std=c99")
if platform.machine() == "x86_64" and platform.system().lower().startswith("linux"):
# Only support CPUs starting from 2008/2009 or so, and run twice as fast as
# a result! This requires sufficiently new gcc, 11 maybe?
extra_compile_args.append("-march=x86-64-v2")
if DEBUGMODE:
extra_compile_args.append("-O0")
extra_compile_args.append("-g")
extra_compile_args.append("-Wall")
extra_compile_args.append("-Wextra")
extra_link_args.append("-g")
undef_macros.append('NDEBUG')
extensions = [
Extension(
"zfec._fec",
[
"zfec/fec.c",
"zfec/_fecmodule.c"
],
include_dirs=["zfec/"],
extra_link_args=extra_link_args,
extra_compile_args=extra_compile_args,
define_macros=define_macros,
undef_macros=undef_macros
)
]
# Most of our metadata lives in setup.cfg [metadata]. We put "name" here
# because the setuptools-22.0.5 on slackware can't find it there, which breaks
# packaging. We put "version" here so that Versioneer works correctly.
setup(
name="zfec",
version=versioneer.get_version(),
description="An efficient, portable erasure coding tool",
long_description=open('README.rst', 'r').read(),
url="https://github.com/tahoe-lafs/zfec",
extras_require={
"bench": ["pyutil >= 3.0.0"],
"test": ["twisted", "pyutil >= 3.0.0", "hypothesis"],
},
ext_modules=extensions,
cmdclass=versioneer.get_cmdclass(),
)