forked from eucalyptus/euca2ools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
251 lines (241 loc) · 11 KB
/
setup.py
File metadata and controls
251 lines (241 loc) · 11 KB
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Software License Agreement (BSD License)
#
# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
# without modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: Neil Soman neil@eucalyptus.com
# Mitch Garnaat mgarnaat@eucalyptus.com
from distutils.core import setup
from distutils.command.build_scripts import build_scripts
from distutils.command.install_scripts import install_scripts
from distutils.command.sdist import sdist
import os.path
import re
import subprocess
from euca2ools import __version__
def get_version():
try:
popen = subprocess.Popen(['git', 'describe'], stdout=subprocess.PIPE)
popen.wait()
return popen.stdout.read().strip()
except:
return __version__
# Cheap hack: install symlinks separately from regular files.
# cmd.copy_tree accepts a preserve_symlinks option, but when we call
# ``setup.py install'' more than once the method fails when it encounters
# symlinks that are already there.
class build_scripts_except_symlinks(build_scripts):
'''Like build_scripts, but ignoring symlinks'''
def copy_scripts(self):
orig_scripts = self.scripts
self.scripts = [script for script in self.scripts
if not os.path.islink(script)]
build_scripts.copy_scripts(self)
self.scripts = orig_scripts
class install_scripts_and_symlinks(install_scripts):
'''Like install_scripts, but also replicating nonexistent symlinks'''
def run(self):
install_scripts.run(self)
# Replicate symlinks if they don't exist
for script in self.distribution.scripts:
if os.path.islink(script):
target = os.readlink(script)
newlink = os.path.join(self.install_dir, os.path.basename(script))
if not os.path.exists(newlink):
os.symlink(target, newlink)
class sdist_with_git_version(sdist):
'''Like sdist, but using the output of ``git describe'' to fill in
__init__.__version__'''
def make_release_tree(self, base_dir, files):
sdist.make_release_tree(self, base_dir, files)
try:
popen = subprocess.Popen(['git', 'describe'],
stdout=subprocess.PIPE)
popen.wait()
version = popen.stdout.read().strip()
version_line = '__version__ = \'{0}\'\n'.format(version)
old_init_file_name = os.path.join(base_dir, 'euca2ools/__init__.py')
new_init_file_name = old_init_file_name + '.new'
with open(new_init_file_name, 'w') as new_init_file:
with open(old_init_file_name) as old_init_file:
for line in old_init_file:
if re.match("__version__ *= *'.*'", line):
new_init_file.write(version_line)
else:
new_init_file.write(line)
new_init_file.flush()
os.rename(new_init_file_name, old_init_file_name)
except:
# Not really a problem; we'll just leave it as-is
pass
setup(name = "euca2ools",
version = get_version(),
description = "Elastic Utility Computing Architecture Command Line Tools",
long_description="Elastic Utility Computing Architecture Command Line Tools",
author = "Mitch Garnaat",
author_email = "mgarnaat@eucalyptus.com",
scripts = ["bin/euare-accountaliascreate",
"bin/euare-accountaliasdelete",
"bin/euare-accountaliaslist",
"bin/euare-accountcreate",
"bin/euare-accountdel",
"bin/euare-accountdelpolicy",
"bin/euare-accountgetpolicy",
"bin/euare-accountgetsummary",
"bin/euare-accountlist",
"bin/euare-accountlistpolicies",
"bin/euare-accountuploadpolicy",
"bin/euare-getldapsyncstatus",
"bin/euare-groupaddpolicy",
"bin/euare-groupadduser",
"bin/euare-groupcreate",
"bin/euare-groupdel",
"bin/euare-groupdelpolicy",
"bin/euare-groupgetpolicy",
"bin/euare-grouplistbypath",
"bin/euare-grouplistpolicies",
"bin/euare-grouplistusers",
"bin/euare-groupmod",
"bin/euare-groupremoveuser",
"bin/euare-groupuploadpolicy",
"bin/euare-servercertdel",
"bin/euare-servercertgetattributes",
"bin/euare-servercertlistbypath",
"bin/euare-servercertmod",
"bin/euare-servercertupload",
"bin/euare-useraddcert",
"bin/euare-useraddkey",
"bin/euare-useraddloginprofile",
"bin/euare-useraddpolicy",
"bin/euare-usercreate",
"bin/euare-usercreatecert",
"bin/euare-userdeactivatemfadevice",
"bin/euare-userdel",
"bin/euare-userdelcert",
"bin/euare-userdelkey",
"bin/euare-userdelloginprofile",
"bin/euare-userdelpolicy",
"bin/euare-userenablemfadevice",
"bin/euare-usergetattributes",
"bin/euare-usergetinfo",
"bin/euare-usergetloginprofile",
"bin/euare-usergetpolicy",
"bin/euare-userlistbypath",
"bin/euare-userlistcerts",
"bin/euare-userlistgroups",
"bin/euare-userlistkeys",
"bin/euare-userlistmfadevices",
"bin/euare-userlistpolicies",
"bin/euare-usermod",
"bin/euare-usermodcert",
"bin/euare-usermodkey",
"bin/euare-usermodloginprofile",
"bin/euare-userresyncmfadevice",
"bin/euare-userupdateinfo",
"bin/euare-useruploadpolicy",
"bin/euca-add-group",
"bin/euca-add-keypair",
"bin/euca-allocate-address",
"bin/euca-associate-address",
"bin/euca-attach-volume",
"bin/euca-authorize",
"bin/euca-bundle-image",
"bin/euca-bundle-instance",
"bin/euca-bundle-upload",
"bin/euca-bundle-vol",
"bin/euca-cancel-bundle-task",
"bin/euca-check-bucket",
"bin/euca-confirm-product-instance",
"bin/euca-create-group",
"bin/euca-create-image",
"bin/euca-create-keypair",
"bin/euca-create-snapshot",
"bin/euca-create-tags",
"bin/euca-create-volume",
"bin/euca-delete-bundle",
"bin/euca-delete-group",
"bin/euca-delete-keypair",
"bin/euca-delete-snapshot",
"bin/euca-delete-tags",
"bin/euca-delete-volume",
"bin/euca-deregister",
"bin/euca-describe-addresses",
"bin/euca-describe-availability-zones",
"bin/euca-describe-bundle-tasks",
"bin/euca-describe-group",
"bin/euca-describe-groups",
"bin/euca-describe-image-attribute",
"bin/euca-describe-images",
"bin/euca-describe-instances",
"bin/euca-describe-keypairs",
"bin/euca-describe-regions",
"bin/euca-describe-snapshots",
"bin/euca-describe-tags",
"bin/euca-describe-volumes",
"bin/euca-detach-volume",
"bin/euca-disassociate-address",
"bin/euca-download-bundle",
"bin/euca-get-console-output",
"bin/euca-get-password",
"bin/euca-get-password-data",
"bin/euca-import-keypair",
"bin/euca-modify-image-attribute",
"bin/euca-monitor-instances",
"bin/euca-reboot-instances",
"bin/euca-register",
"bin/euca-release-address",
"bin/euca-reset-image-attribute",
"bin/euca-revoke",
"bin/euca-run-instances",
"bin/euca-start-instances",
"bin/euca-stop-instances",
"bin/euca-terminate-instances",
"bin/euca-unbundle",
"bin/euca-unmonitor-instances",
"bin/euca-upload-bundle",
"bin/euca-version",
"bin/eustore-describe-images",
"bin/eustore-install-image"],
url = "http://open.eucalyptus.com",
packages = ["euca2ools", "euca2ools.nc", "euca2ools.commands",
"euca2ools.commands.euca", "euca2ools.commands.euare",
"euca2ools.commands.eustore"],
license = 'BSD (Simplified)',
platforms = 'Posix; MacOS X; Windows',
classifiers = ['Development Status :: 5 - Production/Stable',
'Intended Audience :: Users',
'License :: OSI Approved :: Simplified BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Internet'],
cmdclass = {'build_scripts': build_scripts_except_symlinks,
'install_scripts': install_scripts_and_symlinks,
'sdist': sdist_with_git_version})