-
Notifications
You must be signed in to change notification settings - Fork 31
/
setup.py
85 lines (79 loc) · 3.07 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
from __future__ import print_function
try:
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
except ImportError:
print("Please use pip (https://pypi.python.org/pypi/pip) to install.")
raise
import os
from glob import glob
from platform import system
lib = []
if system() == 'Linux':
lib += ['rt']
_ecos = Extension('_ecos', libraries = lib,
# define LDL and AMD to use long ints
# also define that we are building a python module
define_macros = [
('PYTHON',None),
('DLONG', None),
('LDL_LONG', None),
('CTRLC', 1)],
include_dirs = ['ecos/include',
'ecos/external/amd/include',
'ecos/external/ldl/include',
'ecos/external/SuiteSparse_config'],
sources = ['src/ecosmodule.c',
'ecos/external/ldl/src/ldl.c',
'ecos/src/cone.c',
'ecos/src/ctrlc.c',
'ecos/src/ecos.c',
'ecos/src/equil.c',
'ecos/src/expcone.c',
'ecos/src/kkt.c',
'ecos/src/preproc.c',
'ecos/src/spla.c',
'ecos/src/splamm.c',
'ecos/src/timer.c',
'ecos/src/wright_omega.c'
] + glob('ecos/external/amd/src/*.c')
+ glob('ecos/ecos_bb/*.c')) # glob bb source files
def set_builtin(name, value):
if isinstance(__builtins__, dict):
__builtins__[name] = value
else:
setattr(__builtins__, name, value)
class build_ext(_build_ext):
""" This custom class for building extensions exists so we can force
a numpy install before building the extension, thereby giving us
access to the numpy headers.
"""
def finalize_options(self):
_build_ext.finalize_options(self)
# Prevent numpy from thinking it is still in its setup process:
set_builtin("__NUMPY_SETUP__", False)
import numpy
self.include_dirs.append(numpy.get_include())
setup(
name = 'ecos',
version = '2.0.14',
author = 'Alexander Domahidi, Eric Chu, Han Wang, Santiago Akle',
author_email = 'domahidi@embotech.com, echu@cs.stanford.edu, hanwang2@stanford.edu, tiagoakle@gmail.com',
url = 'http://github.com/embotech/ecos',
description = 'This is the Python package for ECOS: Embedded Cone Solver. See Github page for more information.',
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
license = "GPLv3",
packages = ['ecos'],
package_dir = {'': 'src'},
cmdclass = {'build_ext': build_ext},
ext_modules = [_ecos],
setup_requires = [
"numpy >= 1.6"
],
install_requires = [
"numpy >= 1.6",
"scipy >= 0.9"
],
tests_require=['pytest']
)