-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
180 lines (168 loc) · 4.48 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
"""
Script for Cython code compilation.
ref: https://docs.python.org/3/distutils/apiref.html
"""
import os
import argparse
from os.path import join, exists, dirname, abspath, expanduser
from Cython.Build import cythonize
from numpy import get_include
from setuptools import setup, Extension, find_packages
import Cython.Compiler.Options
Cython.Compiler.Options.annotate = True
_wd = abspath(os.curdir)
base = abspath(dirname(__file__))
_incl = [get_include()]
# change to the project directory
os.chdir(base)
# first, create an Extension object w/ appropriate name and sources
ext = [
# ====== DATA STRUCTURES ======
Extension(
name='datastructures.heap',
sources=['datastructures/heap.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
# ====== CO-OCCURRENCE COUNT OF RELATIONS ======
Extension(
name='algorithms.relcooc._relcooc',
sources=['algorithms/relcooc/_relcooc.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
# ====== KNOWLEDGE STREAM (KS) ======
Extension(
name='algorithms.mincostflow.ssp_helper',
sources=['algorithms/mincostflow/ssp_helper.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
############# SM ###################################
Extension(
name='algorithms.sm.rel_closure',
sources=['algorithms/sm/rel_closure.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
Extension(
name='algorithms.sm.shortest_paths',
sources=['algorithms/sm/shortest_paths.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
Extension(
name='algorithms.sm.rel_closure_2',
sources=['algorithms/sm/rel_closure_2.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
Extension(
name='algorithms.sm.yenKSP',
sources=['algorithms/sm/yenKSP.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
Extension(
name='algorithms.sm.extract_paths',
sources=['algorithms/sm/extract_paths.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
Extension(
name='algorithms.sm.extract_paths_par',
sources=['algorithms/sm/extract_paths_par.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
# ====== RELATIONAL KNOWLEDGE LINKER (KL-REL) ======
Extension(
name='algorithms.relklinker.rel_closure',
sources=['algorithms/relklinker/rel_closure.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
# ====== KNOWLEDGE LINKER (KL) ======
Extension(
name='algorithms.klinker.closure',
sources=['algorithms/klinker/closure.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w']
),
# ====== PREDICATE PATH MINING (PREDPATH) ======
Extension(
name='algorithms.pathenum',
sources=['algorithms/pathenum.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w'],
language='c++'
),
# ====== PATH RANKING ALGORITHM (PRA) ======
Extension(
name='algorithms.pra.pra_helper',
sources=['algorithms/pra/pra_helper.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w'],
language='c++'
),
# ====== KATZ (KZ) ======
Extension(
name='algorithms.linkpred.pathenum',
sources=['algorithms/linkpred/pathenum.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w'],
language='c++'
),
# ====== SIMRANK ======
Extension(
name='algorithms.linkpred.simrank_helper',
sources=['algorithms/linkpred/simrank_helper.pyx'],
include_dirs=_incl,
extra_compile_args=['-w'],
extra_link_args=['-w'],
language='c++'
),
]
kwargs = dict(
name="streamminer",
description='Stream Miner Algorithm',
version='0.1.1',
author='Himanshu Ahuja, Alex Michels, original by Prashant Shiralkar and others (see CONTRIBUTORS.md)',
author_email='',
packages=[
'datastructures', 'algorithms', 'algorithms.mincostflow',
'algorithms.relklinker', 'algorithms.klinker'
],
include_package_data=True,
install_requires=[
'numpy',
'scipy',
],
entry_points={
'console_scripts': [
'sm = streamminer:main'
]
},
ext_modules=cythonize(ext)
)
parser = argparse.ArgumentParser(description=__file__, add_help=False)
if __name__ == '__main__':
args, rest = parser.parse_known_args()
kwargs['script_args'] = rest
setup(**kwargs)
# back to the working directory
os.chdir(_wd)