diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2013-02-20 13:29:17 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2013-02-20 13:29:17 +0000 |
| commit | b5fe418c8148b730e325c307edb1bca4c2135902 (patch) | |
| tree | ed53b017b61e5509795d9649a2132e39e09ed5f5 | |
| parent | 8f209c622b4fe105bde914b59a4623507368e060 (diff) | |
| download | nova-b5fe418c8148b730e325c307edb1bca4c2135902.tar.gz nova-b5fe418c8148b730e325c307edb1bca4c2135902.tar.xz nova-b5fe418c8148b730e325c307edb1bca4c2135902.zip | |
Sync latest install_venv_common.py
Syncs:
c78b2ab Avoid using cfg in install_venv_common
So that people don't need oslo-config installed to run install_venv
Change-Id: I05b69f043b276d5e6cd2df5d90bc679df6373383
| -rw-r--r-- | tools/install_venv_common.py | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py index 92230dac7..fd9076f0e 100644 --- a/tools/install_venv_common.py +++ b/tools/install_venv_common.py @@ -21,20 +21,12 @@ virtual environments. Synced in from openstack-common """ +import argparse import os import subprocess import sys -possible_topdir = os.getcwd() -if os.path.exists(os.path.join(possible_topdir, "nova", - "__init__.py")): - sys.path.insert(0, possible_topdir) - - -from oslo.config import cfg - - class InstallVenv(object): def __init__(self, root, venv, pip_requires, test_requires, py_version, @@ -58,7 +50,7 @@ class InstallVenv(object): check_exit_code=True): """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: stdout = subprocess.PIPE @@ -101,7 +93,7 @@ class InstallVenv(object): else: self.run_command(['virtualenv', '-q', self.venv]) print 'done.' - print 'Installing pip in virtualenv...', + print 'Installing pip in venv...', if not self.run_command(['tools/with_venv.sh', 'easy_install', 'pip>1.0']).strip(): self.die("Failed to install pip.") @@ -139,17 +131,12 @@ class InstallVenv(object): def parse_args(self, argv): """Parses command-line arguments.""" - cli_opts = [ - cfg.BoolOpt('no-site-packages', - default=False, - short='n', - help="Do not inherit packages from global Python" - "install"), - ] - CLI = cfg.ConfigOpts() - CLI.register_cli_opts(cli_opts) - CLI(argv[1:]) - return CLI + 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:]) class Distro(InstallVenv): |
