diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-11 18:11:24 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-11 18:11:24 +0000 |
| commit | 20424b987946ee56e39f88aed7fddd35c54d7207 (patch) | |
| tree | 854ef6bba9d37611512007c6e93a6a1404c5795c /tools | |
| parent | 3e4637e8e7887567ac7dbc60e997aa780f029c1c (diff) | |
| parent | 4c891b9243985bb95d8beff8affa9db470a1c94a (diff) | |
Merge "support reloctable venv roots in testing framework"
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/install_venv.py | 16 | ||||
| -rwxr-xr-x | tools/with_venv.sh | 9 |
2 files changed, 17 insertions, 8 deletions
diff --git a/tools/install_venv.py b/tools/install_venv.py index abf56ea0e..17a0be205 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -25,7 +25,7 @@ import sys import install_venv_common as install_venv -def print_help(): +def print_help(venv, root): help = """ Nova development environment setup is complete. @@ -35,21 +35,27 @@ def print_help(): To activate the Nova virtualenv for the extent of your current shell session you can run: - $ source .venv/bin/activate + $ source %s/bin/activate Or, if you prefer, you can run commands in the virtualenv on a case by case basis by running: - $ tools/with_venv.sh <your command> + $ %s/tools/with_venv.sh <your command> Also, make test will automatically use the virtualenv. """ - print help + print help % (venv, root) def main(argv): root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + + if os.environ.get('tools_path'): + root = os.environ['tools_path'] venv = os.path.join(root, '.venv') + if os.environ.get('venv'): + venv = os.environ['venv'] + pip_requires = os.path.join(root, 'tools', 'pip-requires') test_requires = os.path.join(root, 'tools', 'test-requires') py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) @@ -62,7 +68,7 @@ def main(argv): install.create_virtualenv(no_site_packages=options.no_site_packages) install.install_dependencies() install.post_process() - print_help() + print_help(venv, root) if __name__ == '__main__': main(sys.argv) diff --git a/tools/with_venv.sh b/tools/with_venv.sh index 550c4774e..94e05c127 100755 --- a/tools/with_venv.sh +++ b/tools/with_venv.sh @@ -1,4 +1,7 @@ #!/bin/bash -TOOLS=`dirname $0` -VENV=$TOOLS/../.venv -source $VENV/bin/activate && "$@" +tools_path=${tools_path:-$(dirname $0)} +venv_path=${venv_path:-${tools_path}} +venv_dir=${venv_name:-/../.venv} +TOOLS=${tools_path} +VENV=${venv:-${venv_path}/${venv_dir}} +source ${VENV}/bin/activate && "$@" |
