-
Notifications
You must be signed in to change notification settings - Fork 35
/
setup.py
57 lines (40 loc) · 1.38 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
#!/usr/bin/env python
import os
import sys
from numpy.distutils.command.build_ext import build_ext
if sys.version_info[:2] < (3, 7):
raise RuntimeError('pyOpt requires Python version 3.7 or later ({:d}.{:d} detected).'.format(
sys.version_info[:2]))
sys.exit(-1)
class build_opt(build_ext):
def build_extension(self, ext):
try:
build_ext.build_extension(self, ext)
except:
self.announce(f'*** WARNING: Building of optimizer {ext.name} failed: {sys.exc_info()[1]}')
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration(None, parent_package, top_path)
config.set_options(
ignore_setup_xxx_py=True,
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True,
)
config.add_subpackage('pyOpt')
return config
extras={
"test": ["pytest"],
}
extras['dev'] = extras['test']
extras["all"] = sum(extras.values(), [])
if __name__ == '__main__':
from numpy.distutils.core import setup
# from distutils.command.sdist import sdist
setup(
configuration=configuration,
cmdclass = {"build_ext": build_opt,
# 'sdist': sdist # TODO: why does this not work? Why need manifest to include pyOpt?
},
extras_require=extras
)