Merge "Sync latest install_venv_common.py with olso"
This commit is contained in:
commit
66b5a1da21
@ -21,20 +21,12 @@ virtual environments.
|
|||||||
Synced in from openstack-common
|
Synced in from openstack-common
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
possible_topdir = os.getcwd()
|
|
||||||
if os.path.exists(os.path.join(possible_topdir, "quantum",
|
|
||||||
"__init__.py")):
|
|
||||||
sys.path.insert(0, possible_topdir)
|
|
||||||
|
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
|
|
||||||
class InstallVenv(object):
|
class InstallVenv(object):
|
||||||
|
|
||||||
def __init__(self, root, venv, pip_requires, test_requires, py_version,
|
def __init__(self, root, venv, pip_requires, test_requires, py_version,
|
||||||
@ -58,7 +50,7 @@ class InstallVenv(object):
|
|||||||
check_exit_code=True):
|
check_exit_code=True):
|
||||||
"""Runs a command in an out-of-process shell.
|
"""Runs a command in an out-of-process shell.
|
||||||
|
|
||||||
Returns the output of that command. Working directory is ROOT.
|
Returns the output of that command. Working directory is self.root.
|
||||||
"""
|
"""
|
||||||
if redirect_output:
|
if redirect_output:
|
||||||
stdout = subprocess.PIPE
|
stdout = subprocess.PIPE
|
||||||
@ -101,7 +93,7 @@ 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 virtualenv...',
|
print 'Installing pip in venv...',
|
||||||
if not self.run_command(['tools/with_venv.sh', 'easy_install',
|
if not self.run_command(['tools/with_venv.sh', 'easy_install',
|
||||||
'pip>1.0']).strip():
|
'pip>1.0']).strip():
|
||||||
self.die("Failed to install pip.")
|
self.die("Failed to install pip.")
|
||||||
@ -139,17 +131,12 @@ class InstallVenv(object):
|
|||||||
|
|
||||||
def parse_args(self, argv):
|
def parse_args(self, argv):
|
||||||
"""Parses command-line arguments."""
|
"""Parses command-line arguments."""
|
||||||
cli_opts = [
|
parser = argparse.ArgumentParser()
|
||||||
cfg.BoolOpt('no-site-packages',
|
parser.add_argument('-n', '--no-site-packages',
|
||||||
default=False,
|
action='store_true',
|
||||||
short='n',
|
help="Do not inherit packages from global Python "
|
||||||
help="Do not inherit packages from global Python"
|
"install")
|
||||||
"install"),
|
return parser.parse_args(argv[1:])
|
||||||
]
|
|
||||||
CLI = cfg.ConfigOpts()
|
|
||||||
CLI.register_cli_opts(cli_opts)
|
|
||||||
CLI(argv[1:])
|
|
||||||
return CLI
|
|
||||||
|
|
||||||
|
|
||||||
class Distro(InstallVenv):
|
class Distro(InstallVenv):
|
||||||
|
Loading…
Reference in New Issue
Block a user