forked from b45ch1/pyipopt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
146 lines (121 loc) · 4.32 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
#!/usr/bin/env python
""" PYLEVMAR, Python bindings to LEVMAR
Levenberg-Marquardt algorithm for (constrained) least-squares problems
"""
DOCLINES = __doc__.split("\n")
# build with: $ python setup.py build_ext --inplace
# clean with: # python setup.py clean --all
# see:
# http://www.scipy.org/Documentation/numpy_distutils
# http://docs.cython.org/docs/tutorial.html
import os
from distutils.core import setup, Extension
from distutils.core import Command
from numpy.distutils.misc_util import get_numpy_include_dirs
# ADAPT THIS TO FIT YOUR SYSTEM
extra_compile_args = ['-g']
include_dirs = [get_numpy_include_dirs()[0],'pyipopt/src','/home/MGI/syarre/Env/pyOpt-IPOPT/programs/Ipopt-3.9.2/build/include/coin']
library_dirs = ['pyipopt/src','/home/MGI/syarre/Env/pyOpt-IPOPT/lib','/home/MGI/syarre/Env/pyOpt-IPOPT/programs/Ipopt-3.9.2/build/lib/coin','/home/MGI/syarre/Env/pyOpt-IPOPT/programs/Ipopt-3.9.2/build/lib/coin/ThirdParty']
libraries = ['m','coinhsl','coinmetis','lapack','ipopt']
# PACKAGE INFORMATION
CLASSIFIERS = """\
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved
Programming Language :: C
Programming Language :: Python
Topic :: Software Development
Topic :: Scientific/Engineering
Operating System :: Linux
"""
NAME = 'pyipopt'
MAINTAINER = "Sebastian F. Walter"
MAINTAINER_EMAIL = "sebastian.walter@gmail.com"
DESCRIPTION = DOCLINES[0]
LONG_DESCRIPTION = "\n".join(DOCLINES[2:])
URL = "http://github.com/b45ch1/pyipopt"
DOWNLOAD_URL = "http://github.com/b45ch1/pyipopt"
LICENSE = 'GPL'
CLASSIFIERS = filter(None, CLASSIFIERS.split('\n'))
AUTHOR = "Eric You Xu, Sebastian F. Walter"
AUTHOR_EMAIL = "sebastian.walter@gmail.com"
PLATFORMS = ["Linux"]
MAJOR = 0
MINOR = 1
MICRO = 0
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
# IT IS USUALLY NOT NECESSARY TO CHANGE ANTHING BELOW THIS POINT
# override default setup.py help output
import sys
if len(sys.argv) == 1:
print """
You didn't enter what to do!
Options:
1: build the extension with
python setup.py build_ext --inplace
2: remove generated files with
python setup.py clean --all
Remark: This is an override of the default behaviour of the distutils setup.
"""
exit()
class clean(Command):
"""
This class is used in numpy.distutils.core.setup.
When $python setup.py clean is called, an instance of this class is created and then it's run method is called.
"""
description = "Clean everything"
user_options = [("all","a","the same")]
def initialize_options(self):
self.all = None
def finalize_options(self):
pass
def run(self):
import os
os.system("rm -rf build")
os.system("rm *.pyc")
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
platform-neutral way.
"""
if result is None:
result = []
head, tail = os.path.split(path)
if head == '':
return [tail] + result
if head == path:
return result
return fullsplit(head, [tail] + result)
# find all files that should be included
packages, data_files = [], []
for dirpath, dirnames, filenames in os.walk('pyipopt'):
# Ignore dirnames that start with '.'
for i, dirname in enumerate(dirnames):
if dirname.startswith('.'): del dirnames[i]
if '__init__.py' in filenames:
packages.append('.'.join(fullsplit(dirpath)))
elif filenames:
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
options_dict = {}
options_dict.update({
'name':NAME,
'version':VERSION,
'description' :DESCRIPTION,
'long_description' : LONG_DESCRIPTION,
'license':LICENSE,
'author':AUTHOR,
'platforms':PLATFORMS,
'author_email': AUTHOR_EMAIL,
'url':URL,
'packages' :packages,
'ext_package' : 'pyipopt',
'ext_modules': [Extension('_pyipopt', ['pyipopt/src/callback.c', 'pyipopt/src/pyipopt.c' ],
include_dirs = include_dirs,
library_dirs = library_dirs,
runtime_library_dirs = library_dirs,
libraries = libraries),
],
'cmdclass' : {'clean':clean}
})
setup(**options_dict)