From 2ec71d4cd10d961b64fec984d7b4f15dac597347 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Tue, 30 Apr 2013 21:17:40 +0000 Subject: Use optparse for install_venv_common In order to bootstrap a virtualenv from an unmodified 2.6 Python environment, we need to use optparse instead of argparse or openstack.common.cfg. Fixes bug 1174926 Change-Id: Iad636c7adf7b184756eeba5ca760d8a76fc0e354 --- tools/install_venv_common.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py index f0a1722..0401a95 100644 --- a/tools/install_venv_common.py +++ b/tools/install_venv_common.py @@ -18,10 +18,13 @@ """Provides methods needed by installation script for OpenStack development virtual environments. +Since this script is used to bootstrap a virtualenv from the system's Python +environment, it should be kept strictly compatible with Python 2.6. + Synced in from openstack-common """ -import argparse +import optparse import os import subprocess import sys @@ -131,12 +134,12 @@ class InstallVenv(object): def parse_args(self, argv): """Parses command-line arguments.""" - 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:]) + parser = optparse.OptionParser() + parser.add_option('-n', '--no-site-packages', + action='store_true', + help="Do not inherit packages from global Python " + "install") + return parser.parse_args(argv[1:])[0] class Distro(InstallVenv): -- cgit