Import install_venv from oslo
The new version of install_venv_common evaluates requirements.txt and test-requirements.txt at the same time and we avoid Django 1.6 is installed when evaluating django-nose dependencies. Change-Id: I2ab7108b3615ac6c0525089b81b80e5c0a4793fc Closes-Bug: #1250581
This commit is contained in:
parent
7a51bc7ddd
commit
7a0581bb70
@ -2,11 +2,12 @@
|
|||||||
module=config
|
module=config
|
||||||
module=eventlet_backdoor
|
module=eventlet_backdoor
|
||||||
module=fileutils
|
module=fileutils
|
||||||
module=install_venv_common
|
module=install_venv
|
||||||
module=notifier
|
module=notifier
|
||||||
module=policy
|
module=policy
|
||||||
module=rpc
|
module=rpc
|
||||||
module=service
|
module=service
|
||||||
module=threadgroup
|
module=threadgroup
|
||||||
|
module=with_venv
|
||||||
|
|
||||||
base=openstack_dashboard
|
base=openstack_dashboard
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2010 OpenStack Foundation
|
# Copyright 2010 OpenStack Foundation
|
||||||
# Copyright 2013 IBM Corp.
|
# Copyright 2013 IBM Corp.
|
||||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# 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
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -20,31 +19,32 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ConfigParser
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import install_venv_common as install_venv # flake8: noqa
|
import install_venv_common as install_venv # noqa
|
||||||
|
|
||||||
|
|
||||||
def print_help(project, venv, root):
|
def print_help(venv, root):
|
||||||
help = """
|
help = """
|
||||||
%(project)s development environment setup is complete.
|
Openstack development environment setup is complete.
|
||||||
|
|
||||||
%(project)s development uses virtualenv to track and manage Python
|
Openstack development uses virtualenv to track and manage Python
|
||||||
dependencies while in development and testing.
|
dependencies while in development and testing.
|
||||||
|
|
||||||
To activate the %(project)s virtualenv for the extent of your current
|
To activate the Openstack virtualenv for the extent of your current shell
|
||||||
shell session you can run:
|
session you can run:
|
||||||
|
|
||||||
$ source %(venv)s/bin/activate
|
$ source %s/bin/activate
|
||||||
|
|
||||||
Or, if you prefer, you can run commands in the virtualenv on a case by
|
Or, if you prefer, you can run commands in the virtualenv on a case by case
|
||||||
case basis by running:
|
basis by running:
|
||||||
|
|
||||||
$ %(root)s/tools/with_venv.sh <your command>
|
$ %s/tools/with_venv.sh <your command>
|
||||||
|
|
||||||
|
Also, make test will automatically use the virtualenv.
|
||||||
"""
|
"""
|
||||||
print help % dict(project=project, venv=venv, root=root)
|
print(help % (venv, root))
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
@ -59,19 +59,15 @@ def main(argv):
|
|||||||
pip_requires = os.path.join(root, 'requirements.txt')
|
pip_requires = os.path.join(root, 'requirements.txt')
|
||||||
test_requires = os.path.join(root, 'test-requirements.txt')
|
test_requires = os.path.join(root, 'test-requirements.txt')
|
||||||
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
|
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
|
||||||
setup_cfg = ConfigParser.ConfigParser()
|
project = 'Openstack'
|
||||||
setup_cfg.read('setup.cfg')
|
install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
|
||||||
project = setup_cfg.get('metadata', 'name')
|
py_version, project)
|
||||||
|
|
||||||
install = install_venv.InstallVenv(
|
|
||||||
root, venv, pip_requires, test_requires, py_version, project)
|
|
||||||
options = install.parse_args(argv)
|
options = install.parse_args(argv)
|
||||||
install.check_python_version()
|
install.check_python_version()
|
||||||
install.check_dependencies()
|
install.check_dependencies()
|
||||||
install.create_virtualenv(no_site_packages=options.no_site_packages)
|
install.create_virtualenv(no_site_packages=options.no_site_packages)
|
||||||
install.install_dependencies()
|
install.install_dependencies()
|
||||||
install.post_process()
|
print_help(venv, root)
|
||||||
print_help(project, venv, root)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
@ -119,11 +119,7 @@ class InstallVenv(object):
|
|||||||
self.pip_install('setuptools')
|
self.pip_install('setuptools')
|
||||||
self.pip_install('pbr')
|
self.pip_install('pbr')
|
||||||
|
|
||||||
self.pip_install('-r', self.requirements)
|
self.pip_install('-r', self.requirements, '-r', self.test_requirements)
|
||||||
self.pip_install('-r', self.test_requirements)
|
|
||||||
|
|
||||||
def post_process(self):
|
|
||||||
self.get_distro().post_process()
|
|
||||||
|
|
||||||
def parse_args(self, argv):
|
def parse_args(self, argv):
|
||||||
"""Parses command-line arguments."""
|
"""Parses command-line arguments."""
|
||||||
@ -157,14 +153,6 @@ class Distro(InstallVenv):
|
|||||||
' requires virtualenv, please install it using your'
|
' requires virtualenv, please install it using your'
|
||||||
' favorite package management tool' % self.project)
|
' favorite package management tool' % self.project)
|
||||||
|
|
||||||
def post_process(self):
|
|
||||||
"""Any distribution-specific post-processing gets done here.
|
|
||||||
|
|
||||||
In particular, this is useful for applying patches to code inside
|
|
||||||
the venv.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class Fedora(Distro):
|
class Fedora(Distro):
|
||||||
"""This covers all Fedora-based distributions.
|
"""This covers all Fedora-based distributions.
|
||||||
@ -176,10 +164,6 @@ class Fedora(Distro):
|
|||||||
return self.run_command_with_code(['rpm', '-q', pkg],
|
return self.run_command_with_code(['rpm', '-q', pkg],
|
||||||
check_exit_code=False)[1] == 0
|
check_exit_code=False)[1] == 0
|
||||||
|
|
||||||
def apply_patch(self, originalfile, patchfile):
|
|
||||||
self.run_command(['patch', '-N', originalfile, patchfile],
|
|
||||||
check_exit_code=False)
|
|
||||||
|
|
||||||
def install_virtualenv(self):
|
def install_virtualenv(self):
|
||||||
if self.check_cmd('virtualenv'):
|
if self.check_cmd('virtualenv'):
|
||||||
return
|
return
|
||||||
@ -188,27 +172,3 @@ class Fedora(Distro):
|
|||||||
self.die("Please install 'python-virtualenv'.")
|
self.die("Please install 'python-virtualenv'.")
|
||||||
|
|
||||||
super(Fedora, self).install_virtualenv()
|
super(Fedora, self).install_virtualenv()
|
||||||
|
|
||||||
def post_process(self):
|
|
||||||
"""Workaround for a bug in eventlet.
|
|
||||||
|
|
||||||
This currently affects RHEL6.1, but the fix can safely be
|
|
||||||
applied to all RHEL and Fedora distributions.
|
|
||||||
|
|
||||||
This can be removed when the fix is applied upstream.
|
|
||||||
|
|
||||||
Nova: https://bugs.launchpad.net/nova/+bug/884915
|
|
||||||
Upstream: https://bitbucket.org/eventlet/eventlet/issue/89
|
|
||||||
RHEL: https://bugzilla.redhat.com/958868
|
|
||||||
"""
|
|
||||||
|
|
||||||
if os.path.exists('contrib/redhat-eventlet.patch'):
|
|
||||||
# Install "patch" program if it's not there
|
|
||||||
if not self.check_pkg('patch'):
|
|
||||||
self.die("Please install 'patch'.")
|
|
||||||
|
|
||||||
# Apply the eventlet patch
|
|
||||||
self.apply_patch(os.path.join(self.venv, 'lib', self.py_version,
|
|
||||||
'site-packages',
|
|
||||||
'eventlet/green/subprocess.py'),
|
|
||||||
'contrib/redhat-eventlet.patch')
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
TOOLS=`dirname $0`
|
TOOLS_PATH=${TOOLS_PATH:-$(dirname $0)}
|
||||||
VENV=$TOOLS/../.venv
|
VENV_PATH=${VENV_PATH:-${TOOLS_PATH}}
|
||||||
source $VENV/bin/activate && "$@"
|
VENV_DIR=${VENV_NAME:-/../.venv}
|
||||||
|
TOOLS=${TOOLS_PATH}
|
||||||
|
VENV=${VENV:-${VENV_PATH}/${VENV_DIR}}
|
||||||
|
source ${VENV}/bin/activate && "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user