2011-12-31 03:50:15 +00:00
|
|
|
#!/usr/bin/env python2
|
2011-02-27 22:17:45 +00:00
|
|
|
'''
|
|
|
|
The setup script for salt
|
|
|
|
'''
|
2011-11-14 15:49:06 +00:00
|
|
|
|
2011-12-10 20:12:16 +00:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
from glob import glob
|
|
|
|
from distutils.core import setup, Extension
|
|
|
|
from distutils.command.sdist import sdist
|
2011-07-22 17:47:34 +00:00
|
|
|
from distutils.cmd import Command
|
2011-05-23 18:23:42 +00:00
|
|
|
from distutils.sysconfig import get_python_lib, PREFIX
|
2011-12-22 22:56:33 +00:00
|
|
|
|
|
|
|
execfile('salt/version.py')
|
2011-09-25 06:30:36 +00:00
|
|
|
|
2011-12-22 01:36:26 +00:00
|
|
|
class TestCommand(Command):
|
|
|
|
description = 'Run tests'
|
|
|
|
user_options = []
|
|
|
|
def initialize_options(self): pass
|
|
|
|
def finalize_options(self): pass
|
|
|
|
def run(self):
|
|
|
|
from subprocess import Popen
|
|
|
|
self.run_command('build')
|
|
|
|
build_cmd = self.get_finalized_command('build_ext')
|
|
|
|
runner = os.path.abspath('tests/runtests.py')
|
|
|
|
test_cmd = 'python %s' % runner
|
|
|
|
print("running test")
|
|
|
|
test_process = Popen(
|
|
|
|
test_cmd, shell=True,
|
|
|
|
stdout=sys.stdout, stderr=sys.stderr,
|
|
|
|
cwd=build_cmd.build_lib
|
|
|
|
)
|
|
|
|
test_process.communicate()
|
|
|
|
|
2011-12-10 20:12:16 +00:00
|
|
|
try:
|
|
|
|
from Cython.Distutils import build_ext
|
|
|
|
import Cython.Compiler.Main as cython_compiler
|
|
|
|
have_cython = True
|
|
|
|
except ImportError:
|
|
|
|
from distutils.command.build_ext import build_ext
|
|
|
|
have_cython = False
|
|
|
|
|
|
|
|
|
2011-05-12 15:08:43 +00:00
|
|
|
NAME = 'salt'
|
2011-09-25 06:30:36 +00:00
|
|
|
VER = __version__
|
2011-11-09 14:12:15 +00:00
|
|
|
DESC = ('Portable, distributed, remote execution and '
|
|
|
|
'configuration management system')
|
2011-10-24 22:13:47 +00:00
|
|
|
mod_path = os.path.join(get_python_lib(), 'salt/modules')
|
|
|
|
doc_path = os.path.join(PREFIX, 'share/doc', NAME + '-' + VER)
|
2011-05-12 15:08:43 +00:00
|
|
|
example_path = os.path.join(doc_path, 'examples')
|
|
|
|
template_path = os.path.join(example_path, 'templates')
|
2011-11-09 11:57:51 +00:00
|
|
|
|
|
|
|
if 'SYSCONFDIR' in os.environ:
|
2011-05-24 02:00:14 +00:00
|
|
|
etc_path = os.environ['SYSCONFDIR']
|
|
|
|
else:
|
|
|
|
etc_path = os.path.join(os.path.dirname(PREFIX), 'etc')
|
2011-02-27 21:31:57 +00:00
|
|
|
|
2011-12-10 20:12:16 +00:00
|
|
|
# take care of extension modules.
|
|
|
|
if have_cython:
|
|
|
|
sources = ['salt/msgpack/_msgpack.pyx']
|
|
|
|
|
|
|
|
class Sdist(sdist):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
for src in glob('salt/msgpack/*.pyx'):
|
|
|
|
cython_compiler.compile(glob('msgpack/*.pyx'),
|
|
|
|
cython_compiler.default_options)
|
|
|
|
sdist.__init__(self, *args, **kwargs)
|
|
|
|
else:
|
|
|
|
sources = ['salt/msgpack/_msgpack.c']
|
|
|
|
|
|
|
|
Sdist = sdist
|
|
|
|
|
|
|
|
libraries = ['ws2_32'] if sys.platform == 'win32' else []
|
|
|
|
|
|
|
|
msgpack_mod = Extension('salt.msgpack._msgpack',
|
|
|
|
sources=sources,
|
|
|
|
libraries=libraries,
|
|
|
|
)
|
|
|
|
|
2011-08-03 05:02:00 +00:00
|
|
|
setup(
|
|
|
|
name=NAME,
|
2011-05-12 15:08:43 +00:00
|
|
|
version=VER,
|
|
|
|
description=DESC,
|
2011-02-27 21:31:57 +00:00
|
|
|
author='Thomas S Hatch',
|
|
|
|
author_email='thatch45@gmail.com',
|
2011-11-28 05:05:18 +00:00
|
|
|
url='http://saltstack.org',
|
2011-12-10 20:12:16 +00:00
|
|
|
ext_modules=[msgpack_mod],
|
2011-12-22 01:36:26 +00:00
|
|
|
cmdclass={'build_ext': build_ext, 'sdist': Sdist, 'test': TestCommand},
|
2011-11-14 15:49:06 +00:00
|
|
|
classifiers=[
|
2011-05-06 14:28:34 +00:00
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Cython',
|
2011-11-09 11:57:51 +00:00
|
|
|
'Programming Language :: Python :: 2.6',
|
2011-11-09 12:28:22 +00:00
|
|
|
'Programming Language :: Python :: 2.7',
|
2011-08-27 18:50:26 +00:00
|
|
|
'Development Status :: 5 - Production/Stable',
|
2011-05-06 14:28:34 +00:00
|
|
|
'Environment :: Console',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'Intended Audience :: Information Technology',
|
|
|
|
'Intended Audience :: System Administrators',
|
|
|
|
'License :: OSI Approved :: Apache Software License',
|
|
|
|
'Operating System :: POSIX :: Linux',
|
|
|
|
'Topic :: System :: Clustering',
|
|
|
|
'Topic :: System :: Distributed Computing',
|
|
|
|
],
|
2011-04-02 05:38:20 +00:00
|
|
|
packages=['salt',
|
2011-04-16 20:48:13 +00:00
|
|
|
'salt.cli',
|
2011-08-10 17:20:33 +00:00
|
|
|
'salt.ext',
|
|
|
|
'salt.grains',
|
|
|
|
'salt.modules',
|
2011-05-12 18:05:00 +00:00
|
|
|
'salt.renderers',
|
2011-08-10 17:20:33 +00:00
|
|
|
'salt.returners',
|
2011-06-03 04:33:58 +00:00
|
|
|
'salt.runners',
|
2011-04-29 22:07:53 +00:00
|
|
|
'salt.states',
|
2011-07-30 03:40:21 +00:00
|
|
|
'salt.utils',
|
2011-12-10 20:12:16 +00:00
|
|
|
'salt.msgpack',
|
2011-04-16 20:48:13 +00:00
|
|
|
],
|
2011-02-27 21:31:57 +00:00
|
|
|
scripts=['scripts/salt-master',
|
2011-03-09 17:52:22 +00:00
|
|
|
'scripts/salt-minion',
|
2011-07-31 04:24:08 +00:00
|
|
|
'scripts/salt-syndic',
|
2011-05-12 15:08:43 +00:00
|
|
|
'scripts/salt-key',
|
2011-04-13 02:26:04 +00:00
|
|
|
'scripts/salt-cp',
|
2011-04-23 20:34:46 +00:00
|
|
|
'scripts/salt-call',
|
2011-06-03 04:33:58 +00:00
|
|
|
'scripts/salt-run',
|
2011-03-09 17:52:22 +00:00
|
|
|
'scripts/salt'],
|
2011-05-24 02:00:14 +00:00
|
|
|
data_files=[(os.path.join(etc_path, 'salt'),
|
2011-03-03 17:57:11 +00:00
|
|
|
['conf/master',
|
|
|
|
'conf/minion',
|
2011-02-27 21:31:57 +00:00
|
|
|
]),
|
2011-04-02 05:22:19 +00:00
|
|
|
('share/man/man1',
|
2011-05-12 14:46:30 +00:00
|
|
|
['doc/man/salt-master.1',
|
2011-05-14 04:35:00 +00:00
|
|
|
'doc/man/salt-key.1',
|
2011-05-12 14:46:30 +00:00
|
|
|
'doc/man/salt.1',
|
2011-05-14 04:35:00 +00:00
|
|
|
'doc/man/salt-cp.1',
|
2011-08-27 17:32:54 +00:00
|
|
|
'doc/man/salt-call.1',
|
|
|
|
'doc/man/salt-syndic.1',
|
2011-07-09 23:09:15 +00:00
|
|
|
'doc/man/salt-run.1',
|
2011-05-12 14:46:30 +00:00
|
|
|
'doc/man/salt-minion.1',
|
2011-04-02 05:38:20 +00:00
|
|
|
]),
|
2011-04-02 05:22:19 +00:00
|
|
|
('share/man/man7',
|
2011-05-12 14:46:30 +00:00
|
|
|
['doc/man/salt.7',
|
2011-04-02 05:38:20 +00:00
|
|
|
]),
|
2011-04-03 22:25:17 +00:00
|
|
|
(mod_path,
|
|
|
|
['salt/modules/cytest.pyx',
|
2011-05-12 15:08:43 +00:00
|
|
|
]),
|
2011-05-14 20:23:22 +00:00
|
|
|
(doc_path,
|
2011-12-27 00:34:06 +00:00
|
|
|
[
|
2011-05-14 20:23:22 +00:00
|
|
|
]),
|
2011-02-27 21:31:57 +00:00
|
|
|
],
|
|
|
|
)
|