forked from googlegenomics/elasticluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·153 lines (134 loc) · 5.21 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-#
# @(#)setup.py
#
#
# Copyright (C) 2013, 2015 S3IT, University of Zurich. All rights reserved.
#
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
__docformat__ = 'reStructuredText'
import os
import sys
import shutil
# fix Python issue 15881 (on Python <2.7.5)
try:
import multiprocessing
except ImportError:
pass
from setuptools.command import sdist
# Newer versions of setuptools do not have `finders` attribute.
if hasattr(sdist, 'finders'):
del sdist.finders[:]
ANSIBLE_PB_DIR = 'elasticluster/providers/ansible-playbooks'
def ansible_pb_files():
basedir = os.path.dirname(__file__)
ansible_data = [('share/elasticluster/etc', ['docs/config.template'])]
for (dirname, dirnames, filenames) in os.walk(ANSIBLE_PB_DIR):
tmp = []
for fname in filenames:
if fname.startswith('.git'): continue
tmp.append(os.path.join(dirname, fname))
ansible_data.append((os.path.join('share', dirname), tmp))
return ansible_data
from setuptools import setup, find_packages
required_packages = [
'PyCLI',
'paramiko',
'ansible>=1.9.0',
'voluptuous>=0.8.2',
'configobj',
# EC2 clouds
'boto',
# OpenStack clouds
'python-novaclient',
'pbr',
# GCE cloud
'google-api-python-client',
'python-gflags',
]
if sys.version_info < (2, 7):
# Additional dependencies for Python 2.6:
# - Google api python client *requires* argparse,
# cfr. http://code.google.com/p/google-api-python-client/issues/detail?id=299
required_packages.append('argparse')
# - OpenStack's "keystoneclient" requires `importlib`
required_packages.append('importlib')
setup(
name="elasticluster",
version="1.3.dev",
description="A command line tool to create, manage and setup computing clusters hosted on a public or private cloud infrastructure.",
long_description=open('README.rst').read(),
author="Services and Support for Science IT, University of Zurich",
author_email="[email protected]",
license="LGPL",
keywords="cloud openstack amazon ec2 ssh hpc gridengine torque slurm batch job elastic",
url="https://github.com/gc3-uzh-ch/elasticluster",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
"License :: DFSG approved",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: POSIX :: Other",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Topic :: System :: Clustering",
"Topic :: Education",
"Topic :: Scientific/Engineering",
"Topic :: System :: Distributed Computing",
],
packages=find_packages(),
install_requires=required_packages,
tests_require=['tox', 'mock', 'nose'],
data_files=ansible_pb_files(),
entry_points={
'console_scripts': [
'elasticluster = elasticluster.main:main',
]
},
)
if __name__ == "__main__":
if sys.argv[1] in ['develop', 'install']:
develop = True if sys.argv[1] == 'develop' else False
curdir = os.path.abspath(os.path.dirname(__file__))
sharedir = os.path.join(os.path.abspath(sys.prefix), 'share', 'elasticluster')
etcdir = os.path.join(sharedir, 'etc')
templatecfg = os.path.join(curdir, 'docs', 'config.template')
templatedest = os.path.join(etcdir, os.path.basename(templatecfg))
ansibledest = os.path.join(sharedir, 'providers', 'ansible-playbooks')
ansiblesrc = os.path.join(curdir, 'elasticluster', 'providers', 'ansible-playbooks')
if not os.path.exists(sharedir):
os.makedirs(sharedir)
if not os.path.exists(etcdir):
os.makedirs(etcdir)
if not os.path.exists(os.path.dirname(ansibledest)):
os.makedirs(os.path.dirname(ansibledest))
if not os.path.exists(ansibledest):
if develop:
os.symlink(ansiblesrc, ansibledest)
else:
shutil.copytree(ansiblesrc, ansibledest)
if not os.path.exists(templatedest):
if develop:
os.symlink(templatecfg, templatedest)
else:
shutil.copy(templatecfg, etcdir)