From 614a23a9c54d2b7aef32cd6086c416f7745bb51b Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 22 Feb 2013 15:02:57 -0500 Subject: [PATCH] update install_venv_common to handle bootstrapping old install_venv_common used oslo-config, which makes for bad recursive dependencies, and we can't build a venv from a fresh tree. Change-Id: I09336d760842d4eb57f2b70fdfe19afaf6520a48 --- tools/install_venv_common.py | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py index 11888be9c..fd9076f0e 100644 --- a/tools/install_venv_common.py +++ b/tools/install_venv_common.py @@ -21,18 +21,11 @@ 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, "cinder", - "__init__.py")): - sys.path.insert(0, possible_topdir) - - -from oslo.config import cfg - class InstallVenv(object): @@ -57,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 @@ -100,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.") @@ -138,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): -- 2.45.2