-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
54 lines (42 loc) · 1.32 KB
/
Copy pathsetup.py
File metadata and controls
54 lines (42 loc) · 1.32 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
import itertools
from pathlib import Path
from typing import Generator
import numpy as np
from setuptools import setup, Extension
def cglob(path: str) -> Generator[str, None, None]:
"""Generate all .c files in ``path``."""
return (f'{src!s}' for src in Path(path).glob('*.c'))
def list_source_files (paths: tuple[str, ...]) -> list[str]:
"""Generate a list of .c files in found in all of ``paths``."""
return list(itertools.chain.from_iterable(cglob(path) for path in paths))
utils_src = (
'src/vmath',
'src/chainsaddiction/utils',
)
poishmm_src = (
'src/vmath',
'src/chainsaddiction',
'src/chainsaddiction/utils',
'src/chainsaddiction/poishmm',
)
utils = Extension('chainsaddiction.utils',
sources = list_source_files(utils_src),
include_dirs = [
'include',
'src/vmath',
'src/chainsaddiction',
'src/chainsaddiction/utils',
np.get_include(),
],
language = 'c')
poishmm = Extension('chainsaddiction.poishmm',
sources = list_source_files(poishmm_src),
include_dirs = [
'include',
'src/vmath',
'src/chainsaddiction',
'src/chainsaddiction/poishmm',
np.get_include()
],
language = 'c')
setup(ext_modules = [utils, poishmm])