Sync venv scripts from oslo-incubator

Currently install_venv.py and with_venv.sh create virtual
environment in .venv directory and there is no way to specify
the virtual environment path explicitly.

This has been fixed in oslo-incubator.
This patch sync those virtual environment scripts from oslo-incubator.
Also make run_test.sh and run_tempest.sh scripts to use 'VENV' env variable.

Change-Id: I55311cff4dea1f6c5adaa2a6d51eeee2f6cc71ea
Closes-Bug: 1370086
This commit is contained in:
ghanshyam 2015-06-29 13:32:01 +09:00
parent 9ae9616d91
commit f5360ff14f
6 changed files with 15 additions and 10 deletions

View File

@ -3,6 +3,8 @@
# The list of modules to copy from openstack-common # The list of modules to copy from openstack-common
module=install_venv_common module=install_venv_common
module=versionutils module=versionutils
module=with_venv
module=install_venv
# The base module to hold the copy of openstack.common # The base module to hold the copy of openstack.common
base=tempest base=tempest

View File

@ -20,7 +20,7 @@ function usage {
} }
testrargs="" testrargs=""
venv=.venv venv=${VENV:-.venv}
with_venv=tools/with_venv.sh with_venv=tools/with_venv.sh
serial=0 serial=0
always_venv=0 always_venv=0

View File

@ -19,7 +19,7 @@ function usage {
testrargs="" testrargs=""
just_pep8=0 just_pep8=0
venv=.venv venv=${VENV:-.venv}
with_venv=tools/with_venv.sh with_venv=tools/with_venv.sh
serial=0 serial=0
always_venv=0 always_venv=0

View File

@ -48,11 +48,11 @@ def print_help(venv, root):
def main(argv): def main(argv):
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if os.environ.get('tools_path'): if os.environ.get('TOOLS_PATH'):
root = os.environ['tools_path'] root = os.environ['TOOLS_PATH']
venv = os.path.join(root, '.venv') venv = os.path.join(root, '.venv')
if os.environ.get('venv'): if os.environ.get('VENV'):
venv = os.environ['venv'] venv = os.environ['VENV']
pip_requires = os.path.join(root, 'requirements.txt') pip_requires = os.path.join(root, 'requirements.txt')
test_requires = os.path.join(root, 'test-requirements.txt') test_requires = os.path.join(root, 'test-requirements.txt')

View File

@ -101,6 +101,7 @@ class InstallVenv(object):
print('done.') print('done.')
else: else:
print("venv already exists...") print("venv already exists...")
pass
def pip_install(self, *args): def pip_install(self, *args):
self.run_command(['tools/with_venv.sh', self.run_command(['tools/with_venv.sh',
@ -124,7 +125,7 @@ class InstallVenv(object):
parser.add_option('-n', '--no-site-packages', parser.add_option('-n', '--no-site-packages',
action='store_true', action='store_true',
help="Do not inherit packages from global Python " help="Do not inherit packages from global Python "
"install") "install.")
return parser.parse_args(argv[1:])[0] return parser.parse_args(argv[1:])[0]

View File

@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
TOOLS=`dirname $0` TOOLS_PATH=${TOOLS_PATH:-$(dirname $0)/../}
VENV=$TOOLS/../.venv VENV_PATH=${VENV_PATH:-${TOOLS_PATH}}
source $VENV/bin/activate && "$@" VENV_DIR=${VENV_DIR:-/.venv}
VENV=${VENV:-${VENV_PATH}/${VENV_DIR}}
source ${VENV}/bin/activate && "$@"