forked from aldro61/mmit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
74 lines (63 loc) · 2.85 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
#!/usr/bin/env python
"""
MMIT: Max Margin Interval Trees
Copyright (C) 2017 Toby Dylan Hocking, Alexandre Drouin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from platform import system as get_os_name
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext as _build_ext
# Configure the compiler based on the OS
if get_os_name().lower() == "darwin":
os_compile_flags = ["-mmacosx-version-min=10.9"]
os_link_flags = ["-stdlib=libc++", "-mmacosx-version-min=10.9"]
else:
os_compile_flags = []
os_link_flags = []
# Required for the automatic installation of numpy
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
__builtins__.__NUMPY_SETUP__ = False
import numpy
self.include_dirs.append(numpy.get_include())
solver_module = Extension('mmit.core.solver',
language="c++",
sources=['mmit/core/solver_python_bindings.cpp',
'mmit/core/solver.cpp',
'mmit/core/piecewise_function.cpp',
'mmit/core/coefficients.cpp'],
extra_compile_args=["-std=c++0x"] + os_compile_flags,
extra_link_args=os_link_flags)
dependencies = ["joblib", "numpy", "scikit-learn", "six", "future"]
setup(
name = "mmit",
version = "1.1.1",
packages = find_packages(),
cmdclass={'build_ext':build_ext},
setup_requires = dependencies,
install_requires = dependencies,
author = "Alexandre Drouin, Toby Dylan Hocking",
author_email = "[email protected], [email protected]",
maintainer="Alexandre Drouin",
maintainer_email="[email protected]",
description="Maximum Margin Interval Trees",
long_description = "Description: Fast O(p n log n) algorithm for learning a regression tree with interval censored "
"output data.",
license = "GPL-3",
keywords = "machine learning regression tree censored interval data",
url = "https://github.com/aldro61/mmit",
ext_modules = [solver_module],
test_suite='nose.collector',
tests_require=['nose']
)