2013-11-14 07:52:28 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2012-07-01 01:54:25 +00:00
|
|
|
#!/usr/bin/env python
|
2011-02-27 22:17:45 +00:00
|
|
|
'''
|
|
|
|
The setup script for salt
|
|
|
|
'''
|
2011-11-14 15:49:06 +00:00
|
|
|
|
2012-05-07 03:25:14 +00:00
|
|
|
# For Python 2.5. A no-op on 2.6 and above.
|
|
|
|
from __future__ import with_statement
|
|
|
|
|
2011-12-10 20:12:16 +00:00
|
|
|
import os
|
|
|
|
import sys
|
2013-11-12 05:10:41 +00:00
|
|
|
import glob
|
2013-02-06 04:23:56 +00:00
|
|
|
from datetime import datetime
|
2011-07-22 17:47:34 +00:00
|
|
|
from distutils.cmd import Command
|
2013-02-06 04:23:56 +00:00
|
|
|
from distutils.command.build import build
|
2012-10-12 14:51:28 +00:00
|
|
|
from distutils.command.clean import clean
|
2013-11-14 18:06:12 +00:00
|
|
|
from distutils.command.sdist import sdist
|
2011-12-22 22:56:33 +00:00
|
|
|
|
2012-12-30 17:55:23 +00:00
|
|
|
# Change to salt source's directory prior to running any command
|
2013-05-22 01:00:44 +00:00
|
|
|
try:
|
2013-08-23 22:17:13 +00:00
|
|
|
SETUP_DIRNAME = os.path.dirname(__file__)
|
2013-05-22 01:00:44 +00:00
|
|
|
except NameError:
|
|
|
|
# We're most likely being frozen and __file__ triggered this NameError
|
|
|
|
# Let's work around that
|
2013-08-23 22:17:13 +00:00
|
|
|
SETUP_DIRNAME = os.path.dirname(sys.argv[0])
|
2013-05-22 01:00:44 +00:00
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
if SETUP_DIRNAME != '':
|
|
|
|
os.chdir(SETUP_DIRNAME)
|
2012-12-30 17:55:23 +00:00
|
|
|
|
2013-08-23 22:58:26 +00:00
|
|
|
# Store a reference to the executing platform
|
|
|
|
IS_WINDOWS_PLATFORM = sys.platform.startswith('win')
|
|
|
|
|
2012-07-01 02:00:22 +00:00
|
|
|
# Use setuptools only if the user opts-in by setting the USE_SETUPTOOLS env var
|
2013-05-21 23:36:31 +00:00
|
|
|
# Or if setuptools was previously imported (which is the case when using
|
|
|
|
# 'distribute')
|
2012-07-01 02:00:22 +00:00
|
|
|
# This ensures consistent behavior but allows for advanced usage with
|
|
|
|
# virtualenv, buildout, and others.
|
2013-08-23 22:17:13 +00:00
|
|
|
WITH_SETUPTOOLS = False
|
2013-03-20 21:05:20 +00:00
|
|
|
if 'USE_SETUPTOOLS' in os.environ or 'setuptools' in sys.modules:
|
2012-06-30 20:01:57 +00:00
|
|
|
try:
|
|
|
|
from setuptools import setup
|
2013-02-13 10:53:33 +00:00
|
|
|
from setuptools.command.install import install
|
2013-11-14 18:06:12 +00:00
|
|
|
from setuptools.command.sdist import sdist
|
2013-08-23 22:17:13 +00:00
|
|
|
WITH_SETUPTOOLS = True
|
|
|
|
except ImportError:
|
|
|
|
WITH_SETUPTOOLS = False
|
2012-06-30 20:01:57 +00:00
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
if WITH_SETUPTOOLS is False:
|
2013-01-14 13:41:42 +00:00
|
|
|
import warnings
|
2013-02-13 10:53:33 +00:00
|
|
|
from distutils.command.install import install
|
2012-06-05 10:00:20 +00:00
|
|
|
from distutils.core import setup
|
2013-01-14 13:41:42 +00:00
|
|
|
warnings.filterwarnings(
|
|
|
|
'ignore',
|
2013-06-25 18:24:23 +00:00
|
|
|
'Unknown distribution option: \'(tests_require|install_requires|zip_safe)\'',
|
2013-01-14 13:41:42 +00:00
|
|
|
UserWarning,
|
|
|
|
'distutils.dist'
|
|
|
|
)
|
2012-06-05 10:00:20 +00:00
|
|
|
|
2013-01-01 22:49:26 +00:00
|
|
|
try:
|
|
|
|
# Add the esky bdist target if the module is available
|
|
|
|
# may require additional modules depending on platform
|
|
|
|
from esky import bdist_esky
|
|
|
|
# bbfreeze chosen for its tight integration with distutils
|
|
|
|
import bbfreeze
|
|
|
|
HAS_ESKY = True
|
|
|
|
except ImportError:
|
|
|
|
HAS_ESKY = False
|
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
SALT_VERSION = os.path.join(
|
|
|
|
os.path.abspath(SETUP_DIRNAME), 'salt', 'version.py'
|
2013-05-22 01:00:44 +00:00
|
|
|
)
|
2012-07-01 02:47:05 +00:00
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
SALT_REQS = os.path.join(
|
|
|
|
os.path.abspath(SETUP_DIRNAME), 'requirements.txt'
|
2013-05-22 01:00:44 +00:00
|
|
|
)
|
2012-07-01 02:47:05 +00:00
|
|
|
|
2013-08-23 22:58:26 +00:00
|
|
|
SALT_SYSPATHS = os.path.join(
|
|
|
|
os.path.abspath(SETUP_DIRNAME), 'salt', 'syspaths.py'
|
|
|
|
)
|
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
exec(compile(open(SALT_VERSION).read(), SALT_VERSION, 'exec'))
|
2013-08-23 22:58:26 +00:00
|
|
|
exec(compile(open(SALT_SYSPATHS).read(), SALT_SYSPATHS, 'exec'))
|
2011-09-25 06:30:36 +00:00
|
|
|
|
2012-06-30 20:35:31 +00:00
|
|
|
|
2013-11-14 18:06:12 +00:00
|
|
|
class CloudSdist(sdist):
|
|
|
|
user_options = original_sdist.user_options + [
|
|
|
|
('skip-bootstrap-download', None,
|
|
|
|
'Skip downloading the bootstrap-salt.sh script. This can also be '
|
|
|
|
'triggered by having `SKIP_BOOTSTRAP_DOWNLOAD=1` as an environment '
|
|
|
|
'variable.')
|
|
|
|
]
|
|
|
|
boolean_options = original_sdist.boolean_options + [
|
|
|
|
'skip-bootstrap-download'
|
|
|
|
]
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
sdist.initialize_options(self)
|
|
|
|
self.skip_bootstrap_download = False
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
sdist.finalize_options(self)
|
|
|
|
if 'SKIP_BOOTSTRAP_DOWNLOAD' in os.environ:
|
|
|
|
skip_bootstrap_download = os.environ.get(
|
|
|
|
'SKIP_BOOTSTRAP_DOWNLOAD', '0'
|
|
|
|
)
|
|
|
|
self.skip_bootstrap_download = skip_bootstrap_download == '1'
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
if self.skip_bootstrap_download is False:
|
|
|
|
# Let's update the bootstrap-script to the version defined to be
|
|
|
|
# distributed. See BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION above.
|
|
|
|
url = (
|
|
|
|
'https://github.com/saltstack/salt-bootstrap/raw/{0}'
|
|
|
|
'/bootstrap-salt.sh'.format(
|
|
|
|
BOOTSTRAP_SCRIPT_DISTRIBUTED_VERSION
|
|
|
|
)
|
|
|
|
)
|
|
|
|
req = urllib2.urlopen(url)
|
|
|
|
deploy_path = os.path.join(
|
|
|
|
SALTCLOUD_SOURCE_DIR,
|
|
|
|
'saltcloud',
|
|
|
|
'deploy',
|
|
|
|
'bootstrap-salt.sh'
|
|
|
|
)
|
|
|
|
if req.getcode() == 200:
|
|
|
|
try:
|
|
|
|
log.info(
|
|
|
|
'Updating bootstrap-salt.sh.'
|
|
|
|
'\n\tSource: {0}'
|
|
|
|
'\n\tDestination: {1}'.format(
|
|
|
|
url,
|
|
|
|
deploy_path
|
|
|
|
)
|
|
|
|
)
|
|
|
|
with open(deploy_path, 'w') as fp_:
|
|
|
|
fp_.write(req.read())
|
|
|
|
except (OSError, IOError), err:
|
|
|
|
log.error(
|
|
|
|
'Failed to write the updated script: {0}'.format(err)
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
log.error(
|
|
|
|
'Failed to update the bootstrap-salt.sh script. HTTP '
|
|
|
|
'Error code: {0}'.format(
|
|
|
|
req.getcode()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Let's the rest of the build command
|
|
|
|
sdist.run(self)
|
|
|
|
|
|
|
|
|
2011-12-22 01:36:26 +00:00
|
|
|
class TestCommand(Command):
|
|
|
|
description = 'Run tests'
|
2012-09-29 18:41:21 +00:00
|
|
|
user_options = [
|
|
|
|
('runtests-opts=', 'R', 'Command line options to pass to runtests.py')
|
|
|
|
]
|
2012-06-30 20:35:31 +00:00
|
|
|
|
|
|
|
def initialize_options(self):
|
2012-09-29 18:41:21 +00:00
|
|
|
self.runtests_opts = None
|
2012-06-30 20:35:31 +00:00
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
pass
|
|
|
|
|
2011-12-22 01:36:26 +00:00
|
|
|
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')
|
2013-01-18 01:05:45 +00:00
|
|
|
test_cmd = sys.executable + ' {0}'.format(runner)
|
2012-09-29 18:41:21 +00:00
|
|
|
if self.runtests_opts:
|
|
|
|
test_cmd += ' {0}'.format(self.runtests_opts)
|
|
|
|
|
2013-05-21 23:36:31 +00:00
|
|
|
print('running test')
|
2011-12-22 01:36:26 +00:00
|
|
|
test_process = Popen(
|
|
|
|
test_cmd, shell=True,
|
|
|
|
stdout=sys.stdout, stderr=sys.stderr,
|
|
|
|
cwd=build_cmd.build_lib
|
|
|
|
)
|
|
|
|
test_process.communicate()
|
2012-05-05 11:53:39 +00:00
|
|
|
sys.exit(test_process.returncode)
|
2011-12-22 01:36:26 +00:00
|
|
|
|
2012-10-12 14:51:28 +00:00
|
|
|
|
|
|
|
class Clean(clean):
|
|
|
|
def run(self):
|
|
|
|
clean.run(self)
|
|
|
|
# Let's clean compiled *.py[c,o]
|
|
|
|
remove_extensions = ('.pyc', '.pyo')
|
2013-09-26 16:44:14 +00:00
|
|
|
for subdir in ('salt', 'tests', 'doc'):
|
2012-10-12 14:51:28 +00:00
|
|
|
root = os.path.join(os.path.dirname(__file__), subdir)
|
|
|
|
for dirname, dirnames, filenames in os.walk(root):
|
2013-11-12 05:10:41 +00:00
|
|
|
for to_remove_filename in glob.glob(
|
|
|
|
'{0}/*.py[oc]'.format(dirname)):
|
|
|
|
os.remove(to_remove_filename)
|
2012-10-12 14:51:28 +00:00
|
|
|
|
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
INSTALL_VERSION_TEMPLATE = '''\
|
2013-02-06 04:23:56 +00:00
|
|
|
# This file was auto-generated by salt's setup on \
|
2013-03-14 03:36:50 +00:00
|
|
|
{date:%A, %d %B %Y @ %H:%m:%S UTC}.
|
2013-02-06 04:23:56 +00:00
|
|
|
|
|
|
|
__version__ = {version!r}
|
|
|
|
__version_info__ = {version_info!r}
|
2013-05-21 23:36:31 +00:00
|
|
|
'''
|
2013-02-06 04:23:56 +00:00
|
|
|
|
|
|
|
|
2013-09-19 10:42:09 +00:00
|
|
|
INSTALL_SYSPATHS_TEMPLATE = '''\
|
2013-08-23 22:58:26 +00:00
|
|
|
# This file was auto-generated by salt's setup on \
|
|
|
|
{date:%A, %d %B %Y @ %H:%m:%S UTC}.
|
|
|
|
|
|
|
|
ROOT_DIR = {root_dir!r}
|
|
|
|
CONFIG_DIR = {config_dir!r}
|
|
|
|
CACHE_DIR = {cache_dir!r}
|
|
|
|
SOCK_DIR = {sock_dir!r}
|
No more hard-coded salt paths.
All system paths that salt expects and needs are all configurable at install time. This allows for packagers to setup salt's **default** internal paths at build time. For example, under windows, the configuration directory is expected at `c:\salt\conf\`, on FreeBSD at `/usr/local/etc/salt`, etc.
The configurable paths are:
* Salt root directory, `salt_root` in the master and minion configuration files, `--salt-root-dir` option to `python setup.py install`. Default: `/`
* Salt configuration directory, `--salt-config-dir` option to `python setup.py install`. Default: `/etc/salt`
* Salt cache directory, `--salt-cache-dir` option to `python setup.py install`. Default: `/var/cache/salt`
* Salt sock directory, `--salt-sock-dir` option to `python setup.py install`. Default: `/var/run/salt`
* Salt services root directory, `--salt-srv-root-dir` option to `python setup.py install`. Default: `/srv`
* Salt base file roots directory, `--salt-base-file-roots-dir` option to `python setup.py install`. Default: `/srv/salt`
* Salt base pillar roots directory, `--salt-base-pillar-roots-dir` option to `python setup.py install`. Default: `/srv/pillar`
* Salt base master roots directory, `--salt-base-master-roots-dir` option to `python setup.py install`. Default: `/srv/salt-master`
* Salt logs directory, `--salt-logs-dir` option to `python setup.py install`. Default: `/var/log/salt`
* Salt pidfile directory, `--salt-pidfile-dir` option to `python setup.py install`. Default: `/var/run`
2013-08-25 22:55:57 +00:00
|
|
|
SRV_ROOT_DIR= {srv_root_dir!r}
|
2013-08-23 22:58:26 +00:00
|
|
|
BASE_FILE_ROOTS_DIR = {base_file_roots_dir!r}
|
|
|
|
BASE_PILLAR_ROOTS_DIR = {base_pillar_roots_dir!r}
|
|
|
|
BASE_MASTER_ROOTS_DIR = {base_master_roots_dir!r}
|
|
|
|
LOGS_DIR = {logs_dir!r}
|
|
|
|
PIDFILE_DIR = {pidfile_dir!r}
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
2013-02-06 04:23:56 +00:00
|
|
|
class Build(build):
|
|
|
|
def run(self):
|
|
|
|
# Run build.run function
|
|
|
|
build.run(self)
|
|
|
|
if getattr(self.distribution, 'running_salt_install', False):
|
2013-08-23 22:58:26 +00:00
|
|
|
# If our install attribute is present and set to True, we'll go
|
|
|
|
# ahead and write our install time python modules.
|
|
|
|
|
|
|
|
# Write the version file
|
2013-02-06 04:23:56 +00:00
|
|
|
version_file_path = os.path.join(
|
|
|
|
self.build_lib, 'salt', '_version.py'
|
|
|
|
)
|
|
|
|
open(version_file_path, 'w').write(
|
2013-08-23 22:17:13 +00:00
|
|
|
INSTALL_VERSION_TEMPLATE.format(
|
2013-02-06 04:23:56 +00:00
|
|
|
date=datetime.utcnow(),
|
|
|
|
version=__version__,
|
|
|
|
version_info=__version_info__
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2013-08-23 22:58:26 +00:00
|
|
|
# Write the system paths file
|
|
|
|
system_paths_file_path = os.path.join(
|
|
|
|
self.build_lib, 'salt', '_syspaths.py'
|
|
|
|
)
|
|
|
|
open(system_paths_file_path, 'w').write(
|
2013-09-19 10:42:09 +00:00
|
|
|
INSTALL_SYSPATHS_TEMPLATE.format(
|
2013-08-23 22:58:26 +00:00
|
|
|
date=datetime.utcnow(),
|
2013-08-27 08:46:26 +00:00
|
|
|
root_dir=self.distribution.salt_root_dir,
|
|
|
|
config_dir=self.distribution.salt_config_dir,
|
|
|
|
cache_dir=self.distribution.salt_cache_dir,
|
|
|
|
sock_dir=self.distribution.salt_sock_dir,
|
|
|
|
srv_root_dir=self.distribution.salt_srv_root_dir,
|
|
|
|
base_file_roots_dir=self.distribution.salt_base_file_roots_dir,
|
|
|
|
base_pillar_roots_dir=self.distribution.salt_base_pillar_roots_dir,
|
|
|
|
base_master_roots_dir=self.distribution.salt_base_master_roots_dir,
|
|
|
|
logs_dir=self.distribution.salt_logs_dir,
|
|
|
|
pidfile_dir=self.distribution.salt_pidfile_dir,
|
2013-08-23 22:58:26 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2013-02-06 04:23:56 +00:00
|
|
|
|
|
|
|
class Install(install):
|
2013-08-23 22:58:26 +00:00
|
|
|
user_options = install.user_options + [
|
|
|
|
('salt-root-dir=', None,
|
|
|
|
'Salt\'s pre-configured root directory'),
|
|
|
|
('salt-config-dir=', None,
|
|
|
|
'Salt\'s pre-configured configuration directory'),
|
|
|
|
('salt-cache-dir=', None,
|
|
|
|
'Salt\'s pre-configured cache directory'),
|
|
|
|
('salt-sock-dir=', None,
|
|
|
|
'Salt\'s pre-configured socket directory'),
|
No more hard-coded salt paths.
All system paths that salt expects and needs are all configurable at install time. This allows for packagers to setup salt's **default** internal paths at build time. For example, under windows, the configuration directory is expected at `c:\salt\conf\`, on FreeBSD at `/usr/local/etc/salt`, etc.
The configurable paths are:
* Salt root directory, `salt_root` in the master and minion configuration files, `--salt-root-dir` option to `python setup.py install`. Default: `/`
* Salt configuration directory, `--salt-config-dir` option to `python setup.py install`. Default: `/etc/salt`
* Salt cache directory, `--salt-cache-dir` option to `python setup.py install`. Default: `/var/cache/salt`
* Salt sock directory, `--salt-sock-dir` option to `python setup.py install`. Default: `/var/run/salt`
* Salt services root directory, `--salt-srv-root-dir` option to `python setup.py install`. Default: `/srv`
* Salt base file roots directory, `--salt-base-file-roots-dir` option to `python setup.py install`. Default: `/srv/salt`
* Salt base pillar roots directory, `--salt-base-pillar-roots-dir` option to `python setup.py install`. Default: `/srv/pillar`
* Salt base master roots directory, `--salt-base-master-roots-dir` option to `python setup.py install`. Default: `/srv/salt-master`
* Salt logs directory, `--salt-logs-dir` option to `python setup.py install`. Default: `/var/log/salt`
* Salt pidfile directory, `--salt-pidfile-dir` option to `python setup.py install`. Default: `/var/run`
2013-08-25 22:55:57 +00:00
|
|
|
('salt-srv-root-dir=', None,
|
|
|
|
'Salt\'s pre-configured service directory'),
|
2013-08-23 22:58:26 +00:00
|
|
|
('salt-base-file-roots-dir=', None,
|
|
|
|
'Salt\'s pre-configured file roots directory'),
|
|
|
|
('salt-base-pillar-roots-dir=', None,
|
|
|
|
'Salt\'s pre-configured pillar roots directory'),
|
|
|
|
('salt-base-master-roots-dir=', None,
|
|
|
|
'Salt\'s pre-configured master roots directory'),
|
|
|
|
('salt-logs-dir=', None,
|
|
|
|
'Salt\'s pre-configured logs directory'),
|
|
|
|
('salt-pidfile-dir=', None,
|
|
|
|
'Salt\'s pre-configured pidfiles directory'),
|
|
|
|
]
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
install.initialize_options(self)
|
|
|
|
self.salt_root_dir = ROOT_DIR
|
|
|
|
self.salt_config_dir = CONFIG_DIR
|
|
|
|
self.salt_cache_dir = CACHE_DIR
|
|
|
|
self.salt_sock_dir = SOCK_DIR
|
No more hard-coded salt paths.
All system paths that salt expects and needs are all configurable at install time. This allows for packagers to setup salt's **default** internal paths at build time. For example, under windows, the configuration directory is expected at `c:\salt\conf\`, on FreeBSD at `/usr/local/etc/salt`, etc.
The configurable paths are:
* Salt root directory, `salt_root` in the master and minion configuration files, `--salt-root-dir` option to `python setup.py install`. Default: `/`
* Salt configuration directory, `--salt-config-dir` option to `python setup.py install`. Default: `/etc/salt`
* Salt cache directory, `--salt-cache-dir` option to `python setup.py install`. Default: `/var/cache/salt`
* Salt sock directory, `--salt-sock-dir` option to `python setup.py install`. Default: `/var/run/salt`
* Salt services root directory, `--salt-srv-root-dir` option to `python setup.py install`. Default: `/srv`
* Salt base file roots directory, `--salt-base-file-roots-dir` option to `python setup.py install`. Default: `/srv/salt`
* Salt base pillar roots directory, `--salt-base-pillar-roots-dir` option to `python setup.py install`. Default: `/srv/pillar`
* Salt base master roots directory, `--salt-base-master-roots-dir` option to `python setup.py install`. Default: `/srv/salt-master`
* Salt logs directory, `--salt-logs-dir` option to `python setup.py install`. Default: `/var/log/salt`
* Salt pidfile directory, `--salt-pidfile-dir` option to `python setup.py install`. Default: `/var/run`
2013-08-25 22:55:57 +00:00
|
|
|
self.salt_srv_root_dir = SRV_ROOT_DIR
|
2013-08-23 22:58:26 +00:00
|
|
|
self.salt_base_file_roots_dir = BASE_FILE_ROOTS_DIR
|
|
|
|
self.salt_base_pillar_roots_dir = BASE_PILLAR_ROOTS_DIR
|
|
|
|
self.salt_base_master_roots_dir = BASE_MASTER_ROOTS_DIR
|
|
|
|
self.salt_logs_dir = LOGS_DIR
|
|
|
|
self.salt_pidfile_dir = PIDFILE_DIR
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
install.finalize_options(self)
|
|
|
|
for optname in ('root_dir', 'config_dir', 'cache_dir', 'sock_dir',
|
2013-08-27 08:46:26 +00:00
|
|
|
'srv_root_dir', 'base_file_roots_dir',
|
|
|
|
'base_pillar_roots_dir', 'base_master_roots_dir',
|
|
|
|
'logs_dir', 'pidfile_dir'):
|
|
|
|
optvalue = getattr(self, 'salt_{0}'.format(optname))
|
|
|
|
if not optvalue:
|
2013-08-23 22:58:26 +00:00
|
|
|
raise RuntimeError(
|
|
|
|
'The value of --salt-{0} needs a proper path value'.format(
|
|
|
|
optname.replace('_', '-')
|
|
|
|
)
|
|
|
|
)
|
2013-08-27 08:46:26 +00:00
|
|
|
setattr(self.distribution, 'salt_{0}'.format(optname), optvalue)
|
2013-08-23 22:58:26 +00:00
|
|
|
|
2013-02-06 04:23:56 +00:00
|
|
|
def run(self):
|
|
|
|
# Let's set the running_salt_install attribute so we can add
|
|
|
|
# _version.py in the build command
|
|
|
|
self.distribution.running_salt_install = True
|
|
|
|
# Run install.run
|
|
|
|
install.run(self)
|
|
|
|
|
|
|
|
|
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-02-27 21:31:57 +00:00
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
with open(SALT_REQS) as f:
|
|
|
|
REQUIREMENTS = [line for line in f.read().split('\n') if line]
|
2012-03-02 00:17:03 +00:00
|
|
|
|
2012-06-05 10:00:20 +00:00
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
SETUP_KWARGS = {'name': NAME,
|
2012-06-05 10:00:20 +00:00
|
|
|
'version': VER,
|
|
|
|
'description': DESC,
|
|
|
|
'author': 'Thomas S Hatch',
|
|
|
|
'author_email': 'thatch45@gmail.com',
|
|
|
|
'url': 'http://saltstack.org',
|
2013-02-06 04:23:56 +00:00
|
|
|
'cmdclass': {
|
|
|
|
'test': TestCommand,
|
|
|
|
'clean': Clean,
|
|
|
|
'build': Build,
|
|
|
|
'install': Install
|
|
|
|
},
|
2012-06-05 10:00:20 +00:00
|
|
|
'classifiers': ['Programming Language :: Python',
|
|
|
|
'Programming Language :: Cython',
|
|
|
|
'Programming Language :: Python :: 2.6',
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
'Development Status :: 5 - Production/Stable',
|
|
|
|
'Environment :: Console',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'Intended Audience :: Information Technology',
|
|
|
|
'Intended Audience :: System Administrators',
|
2012-07-09 04:50:12 +00:00
|
|
|
('License :: OSI Approved ::'
|
|
|
|
' Apache Software License'),
|
2012-06-05 10:00:20 +00:00
|
|
|
'Operating System :: POSIX :: Linux',
|
|
|
|
'Topic :: System :: Clustering',
|
|
|
|
'Topic :: System :: Distributed Computing',
|
|
|
|
],
|
|
|
|
'packages': ['salt',
|
|
|
|
'salt.cli',
|
2013-08-08 18:43:06 +00:00
|
|
|
'salt.client',
|
2013-08-29 23:00:24 +00:00
|
|
|
'salt.client.ssh',
|
2013-09-02 03:29:20 +00:00
|
|
|
'salt.client.ssh.wrapper',
|
2012-06-05 10:00:20 +00:00
|
|
|
'salt.ext',
|
2012-10-03 19:57:36 +00:00
|
|
|
'salt.auth',
|
2012-10-26 16:05:54 +00:00
|
|
|
'salt.wheel',
|
2012-10-03 20:04:41 +00:00
|
|
|
'salt.tops',
|
2012-06-05 10:00:20 +00:00
|
|
|
'salt.grains',
|
|
|
|
'salt.modules',
|
2012-07-08 05:57:08 +00:00
|
|
|
'salt.pillar',
|
2012-06-05 10:00:20 +00:00
|
|
|
'salt.renderers',
|
|
|
|
'salt.returners',
|
|
|
|
'salt.runners',
|
|
|
|
'salt.states',
|
2012-12-27 20:54:41 +00:00
|
|
|
'salt.fileserver',
|
2012-11-21 05:44:04 +00:00
|
|
|
'salt.search',
|
2012-10-24 22:26:48 +00:00
|
|
|
'salt.output',
|
2012-06-05 10:00:20 +00:00
|
|
|
'salt.utils',
|
2013-09-17 15:40:22 +00:00
|
|
|
'salt.utils.decorators',
|
2013-10-15 11:28:58 +00:00
|
|
|
'salt.utils.validate',
|
2013-07-01 21:52:46 +00:00
|
|
|
'salt.roster',
|
2013-07-20 01:22:23 +00:00
|
|
|
'salt.log',
|
|
|
|
'salt.log.handlers',
|
2013-09-26 21:39:00 +00:00
|
|
|
'salt.templates',
|
2012-06-05 10:00:20 +00:00
|
|
|
],
|
2013-10-03 18:18:23 +00:00
|
|
|
'package_data': {'salt.templates': [
|
|
|
|
'rh_ip/*.jinja',
|
|
|
|
'virt/*.jinja'
|
2013-11-08 21:47:41 +00:00
|
|
|
],
|
2013-10-03 18:18:23 +00:00
|
|
|
},
|
2012-06-05 10:00:20 +00:00
|
|
|
'data_files': [('share/man/man1',
|
2013-11-14 07:52:28 +00:00
|
|
|
['doc/man/salt-cp.1',
|
2012-06-05 10:00:20 +00:00
|
|
|
'doc/man/salt-call.1',
|
|
|
|
'doc/man/salt-minion.1',
|
2012-07-09 04:50:12 +00:00
|
|
|
]),
|
2013-11-14 07:54:31 +00:00
|
|
|
('share/man/man7',
|
|
|
|
['doc/man/salt.7',
|
|
|
|
]),
|
2012-06-05 10:00:20 +00:00
|
|
|
],
|
2013-01-01 22:49:26 +00:00
|
|
|
# Required for esky builds
|
2013-08-23 22:17:13 +00:00
|
|
|
'install_requires': REQUIREMENTS,
|
2012-09-10 18:27:40 +00:00
|
|
|
# The dynamic module loading in salt.modules makes this
|
2013-01-01 22:49:26 +00:00
|
|
|
# package zip unsafe. Required for esky builds
|
2012-09-10 18:27:40 +00:00
|
|
|
'zip_safe': False
|
2012-06-05 10:00:20 +00:00
|
|
|
}
|
|
|
|
|
2013-11-14 07:20:01 +00:00
|
|
|
if IS_WINDOWS_PLATFORM is False:
|
2013-11-14 18:06:12 +00:00
|
|
|
SETUP_KWARGS['cmdclass']['sdist'] = CloudSdist
|
2013-11-14 07:20:01 +00:00
|
|
|
SETUP_KWARGS['packages'].extend(['salt.cloud',
|
|
|
|
'salt.cloud.utils',
|
|
|
|
'salt.cloud.clouds'])
|
|
|
|
SETUP_KWARGS['package_data']['salt.cloud'] = ['deploy/*.sh']
|
2013-11-14 07:52:28 +00:00
|
|
|
SETUP_KWARGS['data_files'][0][1].extend([
|
|
|
|
'doc/man/salt-master.1',
|
|
|
|
'doc/man/salt-key.1',
|
2013-11-14 07:59:33 +00:00
|
|
|
'doc/man/salt.1',
|
2013-11-14 07:52:28 +00:00
|
|
|
'doc/man/salt-syndic.1',
|
|
|
|
'doc/man/salt-run.1',
|
|
|
|
'doc/man/salt-ssh.1',
|
|
|
|
'doc/man/salt-cloud.1'
|
|
|
|
])
|
2013-11-14 07:20:01 +00:00
|
|
|
|
|
|
|
|
2012-09-10 18:27:40 +00:00
|
|
|
# bbfreeze explicit includes
|
|
|
|
# Sometimes the auto module traversal doesn't find everything, so we
|
|
|
|
# explicitly add it. The auto dependency tracking especially does not work for
|
|
|
|
# imports occurring in salt.modules, as they are loaded at salt runtime.
|
|
|
|
# Specifying includes that don't exist doesn't appear to cause a freezing
|
|
|
|
# error.
|
2013-08-23 22:17:13 +00:00
|
|
|
FREEZER_INCLUDES = [
|
2012-09-10 18:27:40 +00:00
|
|
|
'zmq.core.*',
|
|
|
|
'zmq.utils.*',
|
|
|
|
'ast',
|
2012-09-20 01:35:14 +00:00
|
|
|
'difflib',
|
2012-09-23 18:43:39 +00:00
|
|
|
'distutils',
|
2012-11-14 22:24:15 +00:00
|
|
|
'distutils.version',
|
2013-05-15 16:16:43 +00:00
|
|
|
'numbers',
|
2012-11-14 22:24:15 +00:00
|
|
|
'json',
|
2013-10-10 09:01:17 +00:00
|
|
|
'M2Crypto',
|
|
|
|
'Cookie',
|
|
|
|
'asyncore',
|
2013-10-29 18:24:45 +00:00
|
|
|
'fileinput',
|
|
|
|
'email',
|
|
|
|
'email.mime.*',
|
2012-09-10 18:27:40 +00:00
|
|
|
]
|
|
|
|
|
2013-08-23 22:58:26 +00:00
|
|
|
if IS_WINDOWS_PLATFORM:
|
2013-08-23 22:17:13 +00:00
|
|
|
FREEZER_INCLUDES.extend([
|
2012-09-18 20:35:38 +00:00
|
|
|
'win32api',
|
2012-09-19 23:06:07 +00:00
|
|
|
'win32file',
|
2012-09-10 18:27:40 +00:00
|
|
|
'win32con',
|
|
|
|
'win32security',
|
2012-09-18 20:35:38 +00:00
|
|
|
'ntsecuritycon',
|
2012-10-05 20:40:21 +00:00
|
|
|
'_winreg',
|
|
|
|
'wmi',
|
2013-10-28 18:18:36 +00:00
|
|
|
'site',
|
2012-09-10 18:27:40 +00:00
|
|
|
])
|
2013-08-23 22:17:13 +00:00
|
|
|
SETUP_KWARGS['install_requires'].append('WMI')
|
2012-09-10 18:27:40 +00:00
|
|
|
elif sys.platform.startswith('linux'):
|
2013-08-23 22:17:13 +00:00
|
|
|
FREEZER_INCLUDES.append('spwd')
|
2013-05-21 23:45:54 +00:00
|
|
|
try:
|
|
|
|
import yum
|
2013-08-23 22:17:13 +00:00
|
|
|
FREEZER_INCLUDES.append('yum')
|
2013-05-21 23:45:54 +00:00
|
|
|
except ImportError:
|
|
|
|
pass
|
2012-09-10 18:27:40 +00:00
|
|
|
|
2013-01-01 22:49:26 +00:00
|
|
|
if HAS_ESKY:
|
|
|
|
# if the user has the esky / bbfreeze libraries installed, add the
|
|
|
|
# appropriate kwargs to setup
|
2013-08-23 22:17:13 +00:00
|
|
|
OPTIONS = SETUP_KWARGS.get('options', {})
|
|
|
|
OPTIONS['bdist_esky'] = {
|
2013-05-21 23:36:31 +00:00
|
|
|
'freezer_module': 'bbfreeze',
|
|
|
|
'freezer_options': {
|
2013-08-23 22:17:13 +00:00
|
|
|
'includes': FREEZER_INCLUDES
|
2012-11-26 03:06:25 +00:00
|
|
|
}
|
2012-09-10 18:27:40 +00:00
|
|
|
}
|
2013-08-23 22:17:13 +00:00
|
|
|
SETUP_KWARGS['options'] = OPTIONS
|
2012-09-10 18:27:40 +00:00
|
|
|
|
2013-08-23 22:17:13 +00:00
|
|
|
if WITH_SETUPTOOLS:
|
|
|
|
SETUP_KWARGS['entry_points'] = {
|
2013-11-14 07:52:28 +00:00
|
|
|
'console_scripts': ['salt-call = salt.scripts:salt_call',
|
2013-05-21 23:36:31 +00:00
|
|
|
'salt-cp = salt.scripts:salt_cp',
|
2013-11-14 07:52:28 +00:00
|
|
|
'salt-minion = salt.scripts:salt_minion',
|
2013-11-14 07:20:01 +00:00
|
|
|
]
|
2012-06-05 10:00:20 +00:00
|
|
|
}
|
2013-11-14 07:20:01 +00:00
|
|
|
if IS_WINDOWS_PLATFORM is False:
|
2013-11-14 07:52:28 +00:00
|
|
|
SETUP_KWARGS['entry_points']['console_scripts'].extend([
|
|
|
|
'salt = salt.scripts:salt_main',
|
|
|
|
'salt-cloud = salt.scripts:salt_cloud',
|
|
|
|
'salt-key = salt.scripts:salt_key',
|
|
|
|
'salt-master = salt.scripts:salt_master',
|
|
|
|
'salt-run = salt.scripts:salt_run',
|
|
|
|
'salt-ssh = salt.scripts:salt_ssh',
|
|
|
|
'salt-syndic = salt.scripts:salt_syndic',
|
|
|
|
])
|
2013-06-26 20:21:58 +00:00
|
|
|
|
|
|
|
# Required for running the tests suite
|
2013-08-23 22:17:13 +00:00
|
|
|
SETUP_KWARGS['dependency_links'] = [
|
2013-06-26 20:21:58 +00:00
|
|
|
'https://github.com/saltstack/salt-testing/tarball/develop#egg=SaltTesting'
|
|
|
|
]
|
2013-08-23 22:17:13 +00:00
|
|
|
SETUP_KWARGS['tests_require'] = ['SaltTesting']
|
2012-06-05 10:00:20 +00:00
|
|
|
else:
|
2013-11-14 07:59:33 +00:00
|
|
|
SETUP_KWARGS['scripts'] = ['scripts/salt-call',
|
2012-06-05 10:00:20 +00:00
|
|
|
'scripts/salt-cp',
|
2013-11-14 07:52:28 +00:00
|
|
|
'scripts/salt-minion',
|
|
|
|
]
|
2012-06-05 10:00:20 +00:00
|
|
|
|
2013-11-14 07:20:01 +00:00
|
|
|
if IS_WINDOWS_PLATFORM is False:
|
2013-11-14 07:52:28 +00:00
|
|
|
SETUP_KWARGS['scripts'].extend([
|
|
|
|
'scripts/salt',
|
2013-11-14 08:22:17 +00:00
|
|
|
'scripts/salt-cloud',
|
2013-11-14 07:52:28 +00:00
|
|
|
'scripts/salt-key',
|
|
|
|
'scripts/salt-master',
|
|
|
|
'scripts/salt-run',
|
|
|
|
'scripts/salt-ssh',
|
|
|
|
'scripts/salt-syndic',
|
|
|
|
])
|
2013-11-14 07:20:01 +00:00
|
|
|
|
2012-09-23 05:19:39 +00:00
|
|
|
if __name__ == '__main__':
|
2013-08-23 22:17:13 +00:00
|
|
|
setup(**SETUP_KWARGS)
|