Sync install_venv_common from oslo

Also grab a related doc reference while we're at it.

Change-Id: I2590970767f043f35a62a4dfa94be4ee86fbf138
This commit is contained in:
Monty Taylor
2013-07-05 22:27:13 -04:00
parent 15dab5cf61
commit 102c6ea2f0
2 changed files with 16 additions and 26 deletions

View File

@@ -122,7 +122,7 @@ You can manually install the virtual environment instead of having
This will install all of the Python packages listed in the This will install all of the Python packages listed in the
``requirements.txt`` file into your virtualenv. There will also be some ``requirements.txt`` file into your virtualenv. There will also be some
additional packages (pip, distribute, greenlet) that are installed additional packages (pip, setuptools) that are installed
by the ``tools/install_venv.py`` file into the virutalenv. by the ``tools/install_venv.py`` file into the virutalenv.
If all goes well, you should get a message something like this:: If all goes well, you should get a message something like this::

View File

@@ -34,12 +34,13 @@ import sys
class InstallVenv(object): class InstallVenv(object):
def __init__(self, root, venv, pip_requires, test_requires, py_version, def __init__(self, root, venv, requirements,
test_requirements, py_version,
project): project):
self.root = root self.root = root
self.venv = venv self.venv = venv
self.pip_requires = pip_requires self.requirements = requirements
self.test_requires = test_requires self.test_requirements = test_requirements
self.py_version = py_version self.py_version = py_version
self.project = project self.project = project
@@ -75,11 +76,13 @@ class InstallVenv(object):
def get_distro(self): def get_distro(self):
if (os.path.exists('/etc/fedora-release') or if (os.path.exists('/etc/fedora-release') or
os.path.exists('/etc/redhat-release')): os.path.exists('/etc/redhat-release')):
return Fedora(self.root, self.venv, self.pip_requires, return Fedora(
self.test_requires, self.py_version, self.project) self.root, self.venv, self.requirements,
self.test_requirements, self.py_version, self.project)
else: else:
return Distro(self.root, self.venv, self.pip_requires, return Distro(
self.test_requires, self.py_version, self.project) self.root, self.venv, self.requirements,
self.test_requirements, self.py_version, self.project)
def check_dependencies(self): def check_dependencies(self):
self.get_distro().install_virtualenv() self.get_distro().install_virtualenv()
@@ -98,11 +101,6 @@ class InstallVenv(object):
else: else:
self.run_command(['virtualenv', '-q', self.venv]) self.run_command(['virtualenv', '-q', self.venv])
print('done.') 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.')
else: else:
print("venv already exists...") print("venv already exists...")
pass pass
@@ -116,20 +114,12 @@ class InstallVenv(object):
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 # First things first, make sure our venv has the latest pip and
# distribute. # setuptools.
# NOTE: we keep pip at version 1.1 since the most recent version causes self.pip_install('pip>=1.3')
# the .venv creation to fail. See: self.pip_install('setuptools')
# https://bugs.launchpad.net/nova/+bug/1047120
self.pip_install('pip==1.1')
self.pip_install('distribute')
# Install greenlet by hand - just listing it in the requires file does self.pip_install('-r', self.requirements)
# not self.pip_install('-r', self.test_requirements)
# get it installed in the right order
self.pip_install('greenlet')
self.pip_install('-r', self.pip_requires)
self.pip_install('-r', self.test_requires)
def post_process(self): def post_process(self):
self.get_distro().post_process() self.get_distro().post_process()