diff options
author | Kiall Mac Innes <kiall@hp.com> | 2013-05-31 21:32:24 +0100 |
---|---|---|
committer | Kiall Mac Innes <kiall@hp.com> | 2013-05-31 21:41:45 +0100 |
commit | 28becedeeefbaf30d60a55fef0d7117aa112ba8f (patch) | |
tree | a5ad466b2709200bf81eb3d065cfb26230f500a9 /tools | |
parent | 0c7535e4b9a10a21d131ba1a46c91183e624201d (diff) | |
download | designate-28becedeeefbaf30d60a55fef0d7117aa112ba8f.tar.gz |
Switch to PBR
Change-Id: Ib62c6ab685c1bcf14ed363031010c4a145098df6
Diffstat (limited to 'tools')
-rw-r--r-- | tools/install_venv.py | 17 | ||||
-rw-r--r-- | tools/install_venv_common.py | 62 | ||||
-rw-r--r-- | tools/patch_tox_venv.py | 39 | ||||
-rw-r--r-- | tools/pip-options | 7 | ||||
-rw-r--r-- | tools/pip-requires | 14 | ||||
-rw-r--r-- | tools/setup-requires | 0 | ||||
-rw-r--r-- | tools/test-requires | 8 |
7 files changed, 38 insertions, 109 deletions
diff --git a/tools/install_venv.py b/tools/install_venv.py index 096a95b0..16c4f744 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -21,7 +21,7 @@ # under the License. """ -Installation script for BillingStack's development virtualenv +Installation script for Moniker's development virtualenv """ import os @@ -33,12 +33,12 @@ import install_venv_common as install_venv def print_help(): help = """ - BillingStack development environment setup is complete. + Moniker development environment setup is complete. - BillingStack development uses virtualenv to track and manage Python dependencies + Moniker development uses virtualenv to track and manage Python dependencies while in development and testing. - To activate the BillingStack virtualenv for the extent of your current shell + To activate the Moniker virtualenv for the extent of your current shell session you can run: $ source .venv/bin/activate @@ -56,12 +56,11 @@ def print_help(): def main(argv): root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) venv = os.path.join(root, '.venv') - pip_requires = os.path.join(root, 'tools', 'pip-requires') - pip_options = os.path.join(root, 'tools', 'pip-options') - test_requires = os.path.join(root, 'tools', 'test-requires') + pip_requires = os.path.join(root, 'requirements.txt') + test_requires = os.path.join(root, 'test-requirements.txt') py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) - project = 'quantum' - install = install_venv.InstallVenv(root, venv, pip_requires, pip_options, test_requires, + project = 'moniker' + install = install_venv.InstallVenv(root, venv, pip_requires, test_requires, py_version, project) options = install.parse_args(argv) install.check_python_version() diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py index 8123f891..42a44e8c 100644 --- a/tools/install_venv_common.py +++ b/tools/install_venv_common.py @@ -18,10 +18,15 @@ """Provides methods needed by installation script for OpenStack development virtual environments. +Since this script is used to bootstrap a virtualenv from the system's Python +environment, it should be kept strictly compatible with Python 2.6. + Synced in from openstack-common """ -import argparse +from __future__ import print_function + +import optparse import os import subprocess import sys @@ -29,18 +34,17 @@ import sys class InstallVenv(object): - def __init__(self, root, venv, pip_requires, pip_options, test_requires, - py_version, project): + def __init__(self, root, venv, pip_requires, test_requires, py_version, + project): self.root = root self.venv = venv self.pip_requires = pip_requires - self.pip_options = pip_options self.test_requires = test_requires self.py_version = py_version self.project = project def die(self, message, *args): - print >> sys.stderr, message % args + print(message % args, file=sys.stderr) sys.exit(1) def check_python_version(self): @@ -72,12 +76,10 @@ class InstallVenv(object): if (os.path.exists('/etc/fedora-release') or os.path.exists('/etc/redhat-release')): return Fedora(self.root, self.venv, self.pip_requires, - self.pip_options, self.test_requires, - self.py_version, self.project) + self.test_requires, self.py_version, self.project) else: return Distro(self.root, self.venv, self.pip_requires, - self.pip_options, self.test_requires, - self.py_version, self.project) + self.test_requires, self.py_version, self.project) def check_dependencies(self): self.get_distro().install_virtualenv() @@ -89,20 +91,20 @@ class InstallVenv(object): virtual environment. """ if not os.path.isdir(self.venv): - print 'Creating venv...', + print('Creating venv...', end=' ') if no_site_packages: self.run_command(['virtualenv', '-q', '--no-site-packages', self.venv]) else: self.run_command(['virtualenv', '-q', self.venv]) - print 'done.' - print 'Installing pip in venv...', + print('done.') + print('Installing pip in venv...', end=' ') if not self.run_command(['tools/with_venv.sh', 'easy_install', 'pip>1.0']).strip(): self.die("Failed to install pip.") - print 'done.' + print('done.') else: - print "venv already exists..." + print("venv already exists...") pass def pip_install(self, *args): @@ -111,7 +113,7 @@ class InstallVenv(object): redirect_output=False) def install_dependencies(self): - print 'Installing dependencies with pip (this can take a while)...' + print('Installing dependencies with pip (this can take a while)...') # First things first, make sure our venv has the latest pip and # distribute. @@ -127,7 +129,6 @@ class InstallVenv(object): self.pip_install('greenlet') self.pip_install('-r', self.pip_requires) - self.pip_install('-r', self.pip_options) self.pip_install('-r', self.test_requires) def post_process(self): @@ -135,12 +136,12 @@ class InstallVenv(object): def parse_args(self, argv): """Parses command-line arguments.""" - parser = argparse.ArgumentParser() - parser.add_argument('-n', '--no-site-packages', - action='store_true', - help="Do not inherit packages from global Python " - "install") - return parser.parse_args(argv[1:]) + parser = optparse.OptionParser() + parser.add_option('-n', '--no-site-packages', + action='store_true', + help="Do not inherit packages from global Python " + "install") + return parser.parse_args(argv[1:])[0] class Distro(InstallVenv): @@ -154,12 +155,12 @@ class Distro(InstallVenv): return if self.check_cmd('easy_install'): - print 'Installing virtualenv via easy_install...', + print('Installing virtualenv via easy_install...', end=' ') if self.run_command(['easy_install', 'virtualenv']): - print 'Succeeded' + print('Succeeded') return else: - print 'Failed' + print('Failed') self.die('ERROR: virtualenv not found.\n\n%s development' ' requires virtualenv, please install it using your' @@ -184,10 +185,6 @@ class Fedora(Distro): return self.run_command_with_code(['rpm', '-q', pkg], check_exit_code=False)[1] == 0 - def yum_install(self, pkg, **kwargs): - print "Attempting to install '%s' via yum" % pkg - self.run_command(['sudo', 'yum', 'install', '-y', pkg], **kwargs) - def apply_patch(self, originalfile, patchfile): self.run_command(['patch', '-N', originalfile, patchfile], check_exit_code=False) @@ -197,7 +194,7 @@ class Fedora(Distro): return if not self.check_pkg('python-virtualenv'): - self.yum_install('python-virtualenv', check_exit_code=False) + self.die("Please install 'python-virtualenv'.") super(Fedora, self).install_virtualenv() @@ -210,12 +207,13 @@ class Fedora(Distro): This can be removed when the fix is applied upstream. Nova: https://bugs.launchpad.net/nova/+bug/884915 - Upstream: https://bitbucket.org/which_linden/eventlet/issue/89 + Upstream: https://bitbucket.org/eventlet/eventlet/issue/89 + RHEL: https://bugzilla.redhat.com/958868 """ # Install "patch" program if it's not there if not self.check_pkg('patch'): - self.yum_install('patch') + self.die("Please install 'patch'.") # Apply the eventlet patch self.apply_patch(os.path.join(self.venv, 'lib', self.py_version, diff --git a/tools/patch_tox_venv.py b/tools/patch_tox_venv.py deleted file mode 100644 index 7a8f8fbb..00000000 --- a/tools/patch_tox_venv.py +++ /dev/null @@ -1,39 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2013 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import os -import sys - -import install_venv_common as install_venv - - -def main(argv): - root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) - - venv = os.environ['VIRTUAL_ENV'] - - pip_requires = os.path.join(root, 'tools', 'pip-requires') - pip_options = os.path.join(root, 'tools', 'pip-options') - test_requires = os.path.join(root, 'tools', 'test-requires') - py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) - project = 'Quantum' - install = install_venv.InstallVenv(root, venv, pip_requires, pip_options, - test_requires, py_version, project) - #NOTE(dprince): For Tox we only run post_process (which patches files, etc) - install.post_process() - -if __name__ == '__main__': - main(sys.argv) diff --git a/tools/pip-options b/tools/pip-options deleted file mode 100644 index 9bd4fbf0..00000000 --- a/tools/pip-options +++ /dev/null @@ -1,7 +0,0 @@ -# Optional Stuff that is used by default -SQLAlchemy>=0.7.8,<=0.7.9 -sqlalchemy-migrate>=0.7.2 -kombu - -# Needed for Keystone Middleware -python-keystoneclient>=0.2.0 diff --git a/tools/pip-requires b/tools/pip-requires deleted file mode 100644 index 43fecb5c..00000000 --- a/tools/pip-requires +++ /dev/null @@ -1,14 +0,0 @@ -Flask>=0.8 -eventlet -jsonschema>=0.8,<1 -ipaddr -Paste -PasteDeploy -stevedore -cliff - -# From OpenStack Common -routes>=1.12.3 -iso8601>=0.1.4 -WebOb>=1.0.8 -extras diff --git a/tools/setup-requires b/tools/setup-requires deleted file mode 100644 index e69de29b..00000000 --- a/tools/setup-requires +++ /dev/null diff --git a/tools/test-requires b/tools/test-requires deleted file mode 100644 index 424c6855..00000000 --- a/tools/test-requires +++ /dev/null @@ -1,8 +0,0 @@ -unittest2 -nose -openstack.nose_plugin -nosehtmloutput -mox -mock -sphinx -sphinxcontrib-httpdomain |