forked from spacetelescope/calcos
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·43 lines (34 loc) · 943 Bytes
/
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
#!/usr/bin/env python
import os
from fnmatch import fnmatch
from numpy import get_include as numpy_includes
from setuptools import setup, Extension
def c_sources(parent):
sources = []
for root, _, files in os.walk(parent):
for f in files:
fn = os.path.join(root, f)
if fnmatch(fn, '*.c'):
sources.append(fn)
return sources
def c_includes(parent, depth=1):
includes = [parent]
for root, dirs, _ in os.walk(parent):
for d in dirs:
dn = os.path.join(root, d)
if len(dn.split(os.sep)) - 1 > depth:
continue
includes.append(dn)
return includes
PACKAGENAME = 'calcos'
SOURCES = c_sources('src')
INCLUDES = c_includes('src') + [numpy_includes()]
setup(
ext_modules=[
Extension(
PACKAGENAME + '.ccos',
sources=SOURCES,
include_dirs=INCLUDES,
),
],
)