forked from Pyomo/pyomo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
166 lines (151 loc) · 6.15 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
# ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
# rights in this software.
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________
"""
Script to generate the installer for pyomo.
"""
import sys
import os
def _find_packages(path):
"""
Generate a list of nested packages
"""
pkg_list = []
if not os.path.exists(path):
return []
if not os.path.exists(path+os.sep+"__init__.py"):
return []
else:
pkg_list.append(path)
for root, dirs, files in os.walk(path, topdown=True):
if root in pkg_list and "__init__.py" in files:
for name in dirs:
if os.path.exists(root+os.sep+name+os.sep+"__init__.py"):
pkg_list.append(root+os.sep+name)
return [pkg for pkg in map(lambda x:x.replace(os.sep, "."), pkg_list)]
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
requires = [
'PyUtilib>=5.6.3',
'appdirs',
'ply',
'six>=1.4',
]
if sys.version_info < (2, 7):
requires.append('argparse')
requires.append('unittest2')
requires.append('ordereddict')
from setuptools import setup
import sys
if 'develop' in sys.argv:
using_cython = False
else:
using_cython = True
if '--with-cython' in sys.argv:
using_cython = True
sys.argv.remove('--with-cython')
ext_modules = []
if using_cython:
try:
import platform
if not platform.python_implementation() == "CPython":
raise RuntimeError()
from Cython.Build import cythonize
#
# Note: The Cython developers recommend that you destribute C source
# files to users. But this is fine for evaluating the utility of Cython
#
import shutil
files = ["pyomo/core/expr/expr_pyomo5.pyx", "pyomo/core/expr/numvalue.pyx", "pyomo/core/util.pyx", "pyomo/repn/standard_repn.pyx", "pyomo/repn/plugins/cpxlp.pyx", "pyomo/repn/plugins/gams_writer.pyx", "pyomo/repn/plugins/baron_writer.pyx", "pyomo/repn/plugins/ampl/ampl_.pyx"]
for f in files:
shutil.copyfile(f[:-1], f)
ext_modules = cythonize(files)
except:
using_cython = False
packages = _find_packages('pyomo')
setup(name='Pyomo',
#
# Note: trunk should have *next* major.minor
# VOTD and Final releases will have major.minor.revnum
#
# When cutting a release, ALSO update _major/_minor/_revnum in
#
# pyomo/pyomo/version/__init__.py
# pyomo/RELEASE.txt
#
version='5.5.1',
maintainer='William E. Hart',
maintainer_email='wehart@sandia.gov',
url='http://pyomo.org',
license='BSD',
platforms=["any"],
description='Pyomo: Python Optimization Modeling Objects',
long_description=read('README.txt'),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: Jython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Software Development :: Libraries :: Python Modules' ],
packages=packages,
keywords=['optimization'],
install_requires=requires,
ext_modules = ext_modules,
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
entry_points="""
[console_scripts]
runbenders=pyomo.pysp.benders:Benders_main
evaluate_xhat=pyomo.pysp.evaluate_xhat:EvaluateXhat_main
runph=pyomo.pysp.phinit:PH_main
runef=pyomo.pysp.ef_writer_script:main
phsolverserver=pyomo.pysp.phsolverserver:main
scenariotreeserver=pyomo.pysp.scenariotree.server_pyro:main
computeconf=pyomo.pysp.computeconf:main
results_schema=pyomo.scripting.commands:results_schema
pyro_mip_server = pyomo.scripting.pyro_mip_server:main
test.pyomo = pyomo.scripting.runtests:runPyomoTests
pyomo = pyomo.scripting.pyomo_main:main
pyomo_ns = pyomo.scripting.commands:pyomo_ns
pyomo_nsc = pyomo.scripting.commands:pyomo_nsc
kill_pyro_mip_servers = pyomo.scripting.commands:kill_pyro_mip_servers
launch_pyro_mip_servers = pyomo.scripting.commands:launch_pyro_mip_servers
readsol = pyomo.scripting.commands:readsol
OSSolverService = pyomo.scripting.commands:OSSolverService
pyomo_python = pyomo.scripting.commands:pyomo_python
pyomo_old=pyomo.scripting.pyomo_command:main
get_pyomo_extras = scripts.get_pyomo_extras:main
[pyomo.command]
pyomo.runbenders=pyomo.pysp.benders
pyomo.evaluate_xhat=pyomo.pysp.evaluate_xhat
pyomo.runph=pyomo.pysp.phinit
pyomo.runef=pyomo.pysp.ef_writer_script
pyomo.phsolverserver=pyomo.pysp.phsolverserver
pyomo.scenariotreeserver=pyomo.pysp.scenariotree.server_pyro
pyomo.computeconf=pyomo.pysp.computeconf
pyomo.help = pyomo.scripting.driver_help
pyomo.test.pyomo = pyomo.scripting.runtests
pyomo.pyro_mip_server = pyomo.scripting.pyro_mip_server
pyomo.results_schema=pyomo.scripting.commands
"""
)