forked from LanternYing/WSRec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
172 lines (153 loc) · 6.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
#! /usr/bin/env python
'''
Copyright (C) 2016, WS-DREAM, CUHK
License: MIT
'''
description = 'WS-DREAM - A python package to benchmark QoS prediction approaches of Web services'
from distutils.core import setup, Extension
# from setuptools import setup, find_packages
import os, sys
import os.path
import numpy
from distutils.sysconfig import *
# from distutils.util import *
try:
from distutils.command.build_py import build_py_2to3 \
as build_py
except ImportError:
from distutils.command.build_py import build_py
try:
from Cython.Distutils import build_ext
except ImportError:
use_cython = False
else:
use_cython = True
if sys.version_info[0] == 3:
REQUIREMENTS = open('requirements.txt', encoding='utf-8').readlines()
else:
REQUIREMENTS = open('requirements.txt').readlines()
REQUIREMENTS = [req.rstrip() for req in REQUIREMENTS]
extra_compile_args = ['-O2']
#### data files
data_files = []
#### scripts
scripts = []
#### Python include
py_inc = [get_python_inc()]
#### NumPy include
np_inc = [numpy.get_include()]
#### cmdclass
cmdclass = {'build_py': build_py}
#### Extension modules
ext_modules = []
if use_cython:
cmdclass.update({'build_ext': build_ext})
ext_modules += [Extension("wsdream.PMF",
["wsdream/PMF/c_PMF.cpp",
"wsdream/PMF/PMF.pyx"],
language='c++',
include_dirs=py_inc + np_inc),
Extension("wsdream.NTF",
["wsdream/NTF/c_NTF.cpp",
"wsdream/NTF/NTF.pyx"],
language='c++',
include_dirs=py_inc + np_inc),
Extension("wsdream.UIPCC",
["wsdream/UIPCC/c_UIPCC.cpp",
"wsdream/UIPCC/UIPCC.pyx"],
language='c++',
include_dirs=py_inc + np_inc),
Extension("wsdream.NMF",
["wsdream/NMF/c_NMF.cpp",
"wsdream/NMF/NMF.pyx"],
language='c++',
include_dirs=py_inc + np_inc),
Extension("wsdream.EMF",
["wsdream/EMF/c_EMF.cpp",
"wsdream/EMF/c_UIPCC.cpp",
"wsdream/EMF/EMF.pyx"],
language='c++',
include_dirs=py_inc + np_inc,
extra_compile_args=["-O2"]),
Extension("wsdream.BiasedMF",
["wsdream/BiasedMF/c_BiasedMF.cpp",
"wsdream/BiasedMF/BiasedMF.pyx"],
language='c++',
include_dirs=py_inc + np_inc,
extra_compile_args=["-O2"]),
Extension("wsdream.LN_LFM",
["wsdream/LN_LFM/c_LN_LFM.cpp",
"wsdream/LN_LFM/LN_LFM.pyx"],
language='c++',
include_dirs=py_inc + np_inc,
extra_compile_args=["-O2"]),
Extension("wsdream.NIMF",
["wsdream/NIMF/c_NIMF.cpp",
"wsdream/NIMF/c_UIPCC.cpp",
"wsdream/NIMF/NIMF.pyx"],
language='c++',
include_dirs=py_inc + np_inc,
extra_compile_args=["-O2"])
]
else:
ext_modules += [Extension("wsdream.PMF",
["wsdream/PMF/c_PMF.cpp",
"wsdream/PMF/PMF.cpp"],
include_dirs=py_inc + np_inc),
Extension("wsdream.NTF",
["wsdream/NTF/c_NTF.cpp",
"wsdream/NTF/NTF.cpp"],
include_dirs=py_inc + np_inc),
Extension("wsdream.UIPCC",
["wsdream/UIPCC/c_UIPCC.cpp",
"wsdream/UIPCC/UIPCC.cpp"],
include_dirs=py_inc + np_inc),
Extension("wsdream.NMF",
["wsdream/NMF/c_NMF.cpp",
"wsdream/NMF/NMF.cpp"],
include_dirs=py_inc + np_inc),
Extension("wsdream.EMF",
["wsdream/EMF/c_EMF.cpp",
"wsdream/EMF/c_UIPCC.cpp",
"wsdream/EMF/EMF.cpp"],
include_dirs=py_inc + np_inc),
Extension("wsdream.BiasedMF",
["wsdream/BiasedMF/c_BiasedMF.cpp",
"wsdream/BiasedMF/BiasedMF.cpp"],
include_dirs=py_inc + np_inc),
Extension("wsdream.LN_LFM",
["wsdream/BiasedMF/c_LN_LFM.cpp",
"wsdream/BiasedMF/LN_LFM.cpp"],
include_dirs=py_inc + np_inc),
Extension("wsdream.NIMF",
["wsdream/NIMF/c_NIMF.cpp",
"wsdream/NIMF/c_UIPCC.cpp",
"wsdream/NIMF/NIMF.cpp"],
include_dirs=py_inc + np_inc)
]
packages=['wsdream']
classifiers = ['Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT',
'Programming Language :: C++',
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: Artificial Intelligence'
]
setup(name = 'wsdream',
version='1.0',
requires=['numpy (>=1.8.1)', 'scipy (>=0.13.3)'],
description=description,
author='WS-DREAM Team',
author_email='wsdream.maillist@gmail.com',
packages=packages,
url='http://wsdream.github.io',
download_url='https://github.com/wsdream/WS-DREAM',
license='MIT',
classifiers=classifiers,
cmdclass=cmdclass,
ext_modules=ext_modules,
scripts=scripts,
data_files=data_files,
install_requires=REQUIREMENTS
)
print('==============================================')
print('Setup succeeded!\n')