salt/setup.py

148 lines
4.7 KiB
Python
Raw Normal View History

#!/usr/bin/env python
'''
The setup script for salt
'''
2011-12-10 13:12:16 -07:00
import os
import sys
from glob import glob
from distutils.core import setup, Extension
from distutils.command.sdist import sdist
from distutils.cmd import Command
from distutils.sysconfig import get_python_lib, PREFIX
2011-12-10 14:47:06 -07:00
from salt import __version__
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 13:12:16 -07: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
NAME = 'salt'
VER = __version__
DESC = ('Portable, distributed, remote execution and '
'configuration management system')
mod_path = os.path.join(get_python_lib(), 'salt/modules')
doc_path = os.path.join(PREFIX, 'share/doc', NAME + '-' + VER)
example_path = os.path.join(doc_path, 'examples')
template_path = os.path.join(example_path, 'templates')
if 'SYSCONFDIR' in os.environ:
etc_path = os.environ['SYSCONFDIR']
else:
etc_path = os.path.join(os.path.dirname(PREFIX), 'etc')
2011-02-27 14:31:57 -07:00
2011-12-10 13:12:16 -07: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,
)
setup(
name=NAME,
version=VER,
description=DESC,
2011-02-27 14:31:57 -07:00
author='Thomas S Hatch',
author_email='thatch45@gmail.com',
2011-11-27 22:05:18 -07:00
url='http://saltstack.org',
2011-12-10 13:12:16 -07:00
ext_modules=[msgpack_mod],
cmdclass={'build_ext': build_ext, 'sdist': Sdist, 'test': TestCommand},
classifiers=[
2011-05-06 08:28:34 -06:00
'Programming Language :: Python',
'Programming Language :: Cython',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
2011-08-27 12:50:26 -06:00
'Development Status :: 5 - Production/Stable',
2011-05-06 08:28:34 -06: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-01 23:38:20 -06:00
packages=['salt',
2011-04-16 14:48:13 -06:00
'salt.cli',
'salt.ext',
'salt.grains',
'salt.modules',
2011-05-12 12:05:00 -06:00
'salt.renderers',
'salt.returners',
'salt.runners',
2011-04-29 16:07:53 -06:00
'salt.states',
'salt.utils',
2011-12-10 13:12:16 -07:00
'salt.msgpack',
2011-04-16 14:48:13 -06:00
],
2011-02-27 14:31:57 -07:00
scripts=['scripts/salt-master',
2011-03-09 10:52:22 -07:00
'scripts/salt-minion',
2011-07-30 22:24:08 -06:00
'scripts/salt-syndic',
'scripts/salt-key',
2011-04-12 20:26:04 -06:00
'scripts/salt-cp',
2011-04-23 14:34:46 -06:00
'scripts/salt-call',
'scripts/salt-run',
2011-03-09 10:52:22 -07:00
'scripts/salt'],
data_files=[(os.path.join(etc_path, 'salt'),
2011-03-03 10:57:11 -07:00
['conf/master',
'conf/minion',
2011-02-27 14:31:57 -07:00
]),
2011-04-01 23:22:19 -06:00
('share/man/man1',
['doc/man/salt-master.1',
'doc/man/salt-key.1',
'doc/man/salt.1',
'doc/man/salt-cp.1',
2011-08-27 11:32:54 -06:00
'doc/man/salt-call.1',
'doc/man/salt-syndic.1',
2011-07-09 17:09:15 -06:00
'doc/man/salt-run.1',
'doc/man/salt-minion.1',
2011-04-01 23:38:20 -06:00
]),
2011-04-01 23:22:19 -06:00
('share/man/man7',
['doc/man/salt.7',
2011-04-01 23:38:20 -06:00
]),
2011-04-03 16:25:17 -06:00
(mod_path,
['salt/modules/cytest.pyx',
]),
(doc_path,
2011-12-26 16:34:06 -08:00
[
]),
2011-02-27 14:31:57 -07:00
],
)