diff options
author | Mark McLoughlin <markmc@redhat.com> | 2013-02-19 22:35:53 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2013-02-19 22:35:53 +0000 |
commit | c78b2ab9355e1ed6953262daf98e9aefe3c99c79 (patch) | |
tree | a39eb132cd5c5ea0636658b7f7662343643a54f8 /tools | |
parent | f1e5d569b6c9ceb6d7a4b338db9186e4f9c2fb7b (diff) | |
download | oslo-c78b2ab9355e1ed6953262daf98e9aefe3c99c79.tar.gz oslo-c78b2ab9355e1ed6953262daf98e9aefe3c99c79.tar.xz oslo-c78b2ab9355e1ed6953262daf98e9aefe3c99c79.zip |
Avoid using cfg in install_venv_common
Several people have complained that requiring oslo-config to be
installed in order to run install_venv seems like a chicken and egg
problem.
We're only using cfg for a boolean CLI option which is way overkill.
The truth is that cfg is really only interesting if you want to process
options from both the command line and configuration files. Clearly
that's not the case here.
Just use argparse instead of cfg.
Change-Id: Ib602686b554c3548f4be3d4a69d128c5fef7e8cf
Diffstat (limited to 'tools')
-rw-r--r-- | tools/install_venv_common.py | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py index 7cb3968..fd9076f 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, "oslo", - "__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, @@ -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): |