Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 167 lines (152 sloc) 6.361 kB
1a0ccab reorganized the code to be a distutils project (added setup.py)
Justin Riley authored
1 #!/usr/bin/env python
286dc61 @jtriley bump year in license header on all source files
authored
2 # Copyright 2009-2014 Justin Riley
3a975ec @jtriley add LGPL license header to all source files
authored
3 #
4 # This file is part of StarCluster.
5 #
6 # StarCluster is free software: you can redistribute it and/or modify it under
7 # the terms of the GNU Lesser General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or (at your option) any
9 # later version.
10 #
11 # StarCluster is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 # details.
15 #
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with StarCluster. If not, see <http://www.gnu.org/licenses/>.
18
0a04ba5 @jtriley first pass at python2.4 compatibility
authored
19 import os
bb78bbd @jtriley setup.py: error out if installing with < Py2.5
authored
20 import sys
21
9c471f8 @jtriley setup: require Python 2.6+
authored
22 if sys.version_info < (2, 6):
23 error = "ERROR: StarCluster requires Python 2.6+ ... exiting."
bb78bbd @jtriley setup.py: error out if installing with < Py2.5
authored
24 print >> sys.stderr, error
25 sys.exit(1)
9a8395e @jtriley setup.py: support both distutils and setuptools
authored
26
27 try:
28 from setuptools import setup, find_packages
376a738 @jtriley setup: use py.test for 'python setup.py test'
authored
29 from setuptools.command.test import test as TestCommand
30
31 class PyTest(TestCommand):
0b585e3 @jtriley tests: add scaffolding for 'live' tests on AWS
authored
32 user_options = TestCommand.user_options[:]
33 user_options += [
34 ('live', 'L', 'Run live StarCluster tests on a real AWS account'),
e52b36a @jtriley tests: add --coverage option
authored
35 ('coverage', 'C', 'Produce a coverage report for StarCluster'),
0b585e3 @jtriley tests: add scaffolding for 'live' tests on AWS
authored
36 ]
37
38 def initialize_options(self):
39 TestCommand.initialize_options(self)
40 self.live = None
e52b36a @jtriley tests: add --coverage option
authored
41 self.coverage = None
0b585e3 @jtriley tests: add scaffolding for 'live' tests on AWS
authored
42
376a738 @jtriley setup: use py.test for 'python setup.py test'
authored
43 def finalize_options(self):
44 TestCommand.finalize_options(self)
45 self.test_suite = True
0b585e3 @jtriley tests: add scaffolding for 'live' tests on AWS
authored
46 self.test_args = []
e52b36a @jtriley tests: add --coverage option
authored
47 if self.coverage:
48 self.test_args.append('--coverage')
0b585e3 @jtriley tests: add scaffolding for 'live' tests on AWS
authored
49 if self.live:
50 self.test_args.append('--live')
376a738 @jtriley setup: use py.test for 'python setup.py test'
authored
51
52 def run_tests(self):
dcef2b5 @jtriley setup: workaround for pytest plugin loading bug
authored
53 # import here, cause outside the eggs aren't loaded
376a738 @jtriley setup: use py.test for 'python setup.py test'
authored
54 import pytest
dcef2b5 @jtriley setup: workaround for pytest plugin loading bug
authored
55 # Needed in order for pytest_cache to load properly
56 # Alternate fix: import pytest_cache and pass to pytest.main
57 import _pytest.config
58 pm = _pytest.config.get_plugin_manager()
59 pm.consider_setuptools_entrypoints()
376a738 @jtriley setup: use py.test for 'python setup.py test'
authored
60 errno = pytest.main(self.test_args)
61 sys.exit(errno)
62
0113084 @jtriley setup: add setuptools entry_points/console_scripts
authored
63 console_scripts = ['starcluster = starcluster.cli:main']
9a8395e @jtriley setup.py: support both distutils and setuptools
authored
64 extra = dict(test_suite="starcluster.tests",
dcef2b5 @jtriley setup: workaround for pytest plugin loading bug
authored
65 tests_require= ["pytest-cov", "pytest-pep8", "pytest-flakes",
66 "pytest"],
376a738 @jtriley setup: use py.test for 'python setup.py test'
authored
67 cmdclass={"test": PyTest},
f2d6eee @jtriley update deps in setup.py and requirements.txt
authored
68 install_requires=["paramiko>=1.12.1", "boto>=2.23.0",
755cc85 @jtriley update dependencies to latest versions
authored
69 "workerpool>=0.9.2", "Jinja2>=2.7",
7716e00 @jtriley use pycrypto to compute pub/priv rsa fingerprints
authored
70 "decorator>=3.4.0", "iptools>=0.6.1",
71 "optcomplete>=1.2-devel",
f2d6eee @jtriley update deps in setup.py and requirements.txt
authored
72 "pycrypto>=2.5", "scp>=0.7.1",
3c4bf18 @jtriley utils: use UTC timezone for all time stamps
authored
73 "iso8601>=0.1.8"],
d60b70e @jtriley MANIFEST.in: add package_data to sdist
authored
74 include_package_data=True,
0113084 @jtriley setup: add setuptools entry_points/console_scripts
authored
75 entry_points=dict(console_scripts=console_scripts),
5a811fd @jtriley add package data for new spot plot server
authored
76 zip_safe=False)
9a8395e @jtriley setup.py: support both distutils and setuptools
authored
77 except ImportError:
78 import string
aa84c8b @jtriley setup.py: work-around redef of unused import
authored
79 from distutils.core import setup
9a8395e @jtriley setup.py: support both distutils and setuptools
authored
80
81 def convert_path(pathname):
82 """
83 Local copy of setuptools.convert_path used by find_packages (only used
84 with distutils which is missing the find_packages feature)
85 """
86 if os.sep == '/':
87 return pathname
88 if not pathname:
89 return pathname
90 if pathname[0] == '/':
91 raise ValueError("path '%s' cannot be absolute" % pathname)
92 if pathname[-1] == '/':
93 raise ValueError("path '%s' cannot end with '/'" % pathname)
94 paths = string.split(pathname, '/')
95 while '.' in paths:
96 paths.remove('.')
97 if not paths:
98 return os.curdir
99 return os.path.join(*paths)
100
aa84c8b @jtriley setup.py: work-around redef of unused import
authored
101 def find_packages(where='.', exclude=()):
9a8395e @jtriley setup.py: support both distutils and setuptools
authored
102 """
103 Local copy of setuptools.find_packages (only used with distutils which
104 is missing the find_packages feature)
105 """
106 out = []
107 stack = [(convert_path(where), '')]
108 while stack:
109 where, prefix = stack.pop(0)
110 for name in os.listdir(where):
111 fn = os.path.join(where, name)
aa84c8b @jtriley setup.py: work-around redef of unused import
authored
112 isdir = os.path.isdir(fn)
113 has_init = os.path.isfile(os.path.join(fn, '__init__.py'))
114 if '.' not in name and isdir and has_init:
9a8395e @jtriley setup.py: support both distutils and setuptools
authored
115 out.append(prefix + name)
116 stack.append((fn, prefix + name + '.'))
117 for pat in list(exclude) + ['ez_setup', 'distribute_setup']:
118 from fnmatch import fnmatchcase
119 out = [item for item in out if not fnmatchcase(item, pat)]
120 return out
121
1c89cd4 @jtriley setup: only use 'scripts' kwarg if there's no setuptools
authored
122 extra = {'scripts': ['bin/starcluster']}
0a04ba5 @jtriley first pass at python2.4 compatibility
authored
123
5d49105 @jtriley fix bug with setup.py and easy_install
authored
124 VERSION = 0.9999
125 static = os.path.join('starcluster', 'static.py')
126 execfile(static) # pull VERSION from static.py
1f29e3d @jtriley import starcluster after modifying sys.path
authored
127
9bca68d @jtriley setup: use README.rst for long_description
authored
128 README = open('README.rst').read()
129
1a0ccab reorganized the code to be a distutils project (added setup.py)
Justin Riley authored
130 setup(
319d637 @jtriley massive code cleanup (pep8/pyflakes)
authored
131 name='StarCluster',
5d49105 @jtriley fix bug with setup.py and easy_install
authored
132 version=VERSION,
133 packages=find_packages(),
bb78bbd @jtriley setup.py: error out if installing with < Py2.5
authored
134 package_data={'starcluster.templates':
f6ed5b8 @jtriley Revert "awsutils: force boto to use latest cacerts file"
authored
135 ['web/*.*', 'web/css/*', 'web/js/*']},
0a04ba5 @jtriley first pass at python2.4 compatibility
authored
136 license='LGPL3',
1a0ccab reorganized the code to be a distutils project (added setup.py)
Justin Riley authored
137 author='Justin Riley',
138 author_email='justin.t.riley@gmail.com',
6112724 @jtriley update StarCluster web links project-wide
authored
139 url="http://star.mit.edu/cluster",
be2cda3 @jtriley setup.py: make pep8 and pyflakes clean
authored
140 description="StarCluster is a utility for creating and managing computing "
141 "clusters hosted on Amazon's Elastic Compute Cloud (EC2).",
9bca68d @jtriley setup: use README.rst for long_description
authored
142 long_description=README,
86106dc added classifiers to setup.py
Justin Riley authored
143 classifiers=[
144 'Environment :: Console',
145 'Development Status :: 4 - Beta',
146 'Intended Audience :: Developers',
147 'Intended Audience :: Education',
148 'Intended Audience :: System Administrators',
149 'Intended Audience :: Other Audience',
150 'Intended Audience :: Science/Research',
be2cda3 @jtriley setup.py: make pep8 and pyflakes clean
authored
151 'License :: OSI Approved :: GNU Library or Lesser General Public '
152 'License (LGPL)',
86106dc added classifiers to setup.py
Justin Riley authored
153 'Natural Language :: English',
154 'Programming Language :: Python',
513dd0e @jtriley setup: add Python versions to trove classifiers
authored
155 'Programming Language :: Python :: 2.6',
156 'Programming Language :: Python :: 2.7',
1d86d57 @jtriley setup: add more pypi classifiers
authored
157 'Operating System :: OS Independent',
158 'Operating System :: POSIX',
86106dc added classifiers to setup.py
Justin Riley authored
159 'Topic :: Education',
160 'Topic :: Scientific/Engineering',
161 'Topic :: System :: Distributed Computing',
162 'Topic :: System :: Clustering',
1d86d57 @jtriley setup: add more pypi classifiers
authored
163 'Topic :: Software Development :: Libraries :: Python Modules',
86106dc added classifiers to setup.py
Justin Riley authored
164 ],
9a8395e @jtriley setup.py: support both distutils and setuptools
authored
165 **extra
1a0ccab reorganized the code to be a distutils project (added setup.py)
Justin Riley authored
166 )
Something went wrong with that request. Please try again.