forked from cloudmesh/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
212 lines (181 loc) · 6.87 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#!/usr/bin/env python
# ----------------------------------------------------------------------- #
# Copyright 2008-2010, Gregor von Laszewski #
# Copyright 2010-2013, Indiana University #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.#
# See the License for the specific language governing permissions and #
# limitations under the License. #
# ------------------------------------------------------------------------#
from __future__ import print_function
import platform
import os
from setuptools.command.install import install
from setuptools.command.test import test as TestCommand
from setuptools import setup, find_packages
from cloudmesh_base.setup import *
try:
import cloudmesh_base
print ("Using cloudmesh_base version:", cloudmesh_base.__version__)
except:
# os.system("pip install cloudmesh_base")
os.system("pip install git+https://github.com/cloudmesh/base.git")
from cloudmesh_base.util import banner
from cloudmesh_base.setup import os_execute
from cloudmesh_client import __version__
banner("Installing Cloudmesh_client {:}".format(__version__))
requirements = ['pyreadline<=1.7.1.dev-r0',
'colorama',
'cloudmesh_base',
'future',
'docopt',
'pyaml',
'simplejson',
'python-hostlist',
'prettytable',
'sqlalchemy',
'urllib3',
'requests',
'httpsig',
'sandman',
'gitchangelog',
'six',
'python-novaclient',
'cloudmesh_timestring']
class UploadToPypitest(install):
"""Upload the package to pypi. -- only for Maintainers."""
description = __doc__
def run(self):
os.system("make clean")
commands = """
python setup.py install
python setup.py bdist_wheel
python setup.py sdist --format=bztar,zip upload -r pypitest
python setup.py bdist_wheel upload -r pypitest
"""
os_execute(commands)
class UploadToPypi(install):
"""Upload the package to pypi. -- only for Maintainers."""
description = __doc__
def run(self):
os.system("make clean")
commands = """
python setup.py install
python setup.py bdist_wheel
python setup.py sdist --format=bztar,zip upload
python setup.py bdist_wheel upload
"""
os_execute(commands)
class InstallBase(install):
"""Install the cloudmesh_client package."""
description = __doc__
def run(self):
banner("Install readline")
commands = None
this_platform = platform.system().lower()
if this_platform in ['darwin']:
commands = """
easy_install readline
"""
elif this_platform in ['windows']:
commands = """
pip install pyreadline
"""
if commands:
os_execute(commands)
banner("Install Cloudmesh_client {:}".format(__version__))
install.run(self)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
home = os.path.expanduser("~")
data_files= [ (os.path.join(home, '.cloudmesh'),
[os.path.join(d, f) for f in files]) for d, folders, files in os.walk(
os.path.join('cloudmesh_client', 'etc'))]
package_data={
'cloudmesh_client.etc': ['*.yaml', '*.py'],
},
# Hack because for some reason requirements does not work
#
# os.system("pip install -r requirements.txt")
class Tox(TestCommand):
user_options = [('tox-args=', 'a', "Arguments to pass to tox")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.tox_args = None
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
#import here, cause outside the eggs aren't loaded
import tox
import shlex
args = self.tox_args
if args:
args = shlex.split(self.tox_args)
errno = tox.cmdline(args=args)
sys.exit(errno)
setup(
version=__version__,
name="cloudmesh_client",
description="cloudmesh_client - A heterogeneous multi cloud command "
"client command shell",
long_description=read('README.rst'),
license="Apache License, Version 2.0",
author="Gregor von Laszewski",
author_email="[email protected]",
url="https://github.com/cloudmesh/cloudmesh_client",
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 2.7",
"Topic :: Scientific/Engineering",
"Topic :: System :: Clustering",
"Topic :: System :: Distributed Computing",
"Topic :: Software Development :: Libraries :: Python Modules",
"Environment :: Console"
],
keywords="cloud cmd commandshell plugins",
packages=find_packages(),
install_requires=requirements,
include_package_data=True,
data_files= data_files,
package_data={
'cloudmesh_client.etc': ['*.yaml', '*.py'],
},
entry_points={
'console_scripts': [
'cm = cloudmesh_client.shell.cm:main',
'ghost = cloudmesh_client.shell.ghost:main',
],
},
tests_require=['tox'],
cmdclass={
'install': InstallBase,
'pypi': Make("pypi", repo='pypi'),
'pypifinal': Make("pypi", repo='final'),
'registerpypi': Make("pypi", repo='pypi'),
'registerfinal': Make("pypi", repo='final'),
'rmtag': Make('rmtag'),
'tag': Make("tag"),
'doc': Make("doc"),
'view': Make("view"),
'clean': Make("clean"),
'test': Tox,
},
dependency_links = []
)