-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
85 lines (76 loc) · 2.68 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
import os
from setuptools import setup, Extension
from distutils.sysconfig import customize_compiler
import Cython.Build
from Cython.Build import cythonize
def CppExtension(name, sources):
return Extension(
name,
sources=sources,
language="c++",
extra_compile_args=["-std=c++11", "-Werror=return-type", "-Werror=narrowing"],
undef_macros=["NDEBUG"],
)
extensions = [
CppExtension(
"giggles.core",
sources=[
"giggles/core.pyx",
"src/pedigree.cpp",
"src/columnindexingiterator.cpp",
"src/column.cpp",
"src/entry.cpp",
"src/graycodes.cpp",
"src/read.cpp",
"src/readset.cpp",
"src/columniterator.cpp",
"src/indexset.cpp",
"src/genotype.cpp",
"src/binomial.cpp",
"src/phredgenotypelikelihoods.cpp",
"src/genotypedistribution.cpp",
"src/genotypehmm.cpp",
"src/backwardcolumniterator.cpp",
"src/transitionprobabilitycomputer.cpp"
],
),
CppExtension("giggles.readselect", sources=["giggles/readselect.pyx"]),
CppExtension("giggles.align", sources=["giggles/align.pyx"]),
CppExtension("giggles.priorityqueue", sources=["giggles/priorityqueue.pyx"]),
CppExtension("giggles._variants", sources=["giggles/_variants.pyx"]),
]
class BuildExt(Cython.Build.build_ext):
def build_extensions(self):
# Remove the warning about “-Wstrict-prototypes” not being valid for C++,
# see http://stackoverflow.com/a/36293331/715090
customize_compiler(self.compiler)
if self.compiler.compiler_so[0].endswith("clang"):
# Clang needs this option in order to find the unordered_set header
print("detected clang, using option -stdlib=libc++")
self.compiler.compiler_so.append("-stdlib=libc++")
try:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
except (AttributeError, ValueError):
pass
super().build_extensions()
# Avoid compilation if we are being installed within Read The Docs
if os.environ.get("READTHEDOCS") == "True":
cmdclass = {}
ext_modules = []
install_requires = []
else:
cmdclass = {"build_ext": BuildExt}
ext_modules = extensions
install_requires = [
"pysam>=0.18.0",
"pyfaidx>=0.5.5.2",
"biopython>=1.73", # pyfaidx needs this for reading bgzipped FASTA files
"xopen>=1.2.0",
"pywfa"
]
setup(
use_scm_version={"write_to": "giggles/_version.py"},
cmdclass=cmdclass,
ext_modules=cythonize(ext_modules),
install_requires=install_requires,
)