devstack/tools/build_venv.sh
Dean Troyer 99c463d56d Recent virtualenv review cleanups
This is a follow-on to comments in https://review.openstack.org/156356
and https://review.openstack.org/#/c/151513/

* Remove work-around for /var/cache/pip
* Remove WHEELHOUSE setting in tools/build_wheels.sh and use the pip
  default directory '<cwd>/wheelhouse'
* Remove bogus MySQL-python install
* Removed unused bits and clean up pip commands in from tools/build_venvs.sh

Closes-Bug: #1423720
Change-Id: I0283b0dff9146b1b63bd821358505a93566270c6
2015-02-20 08:56:53 -06:00

47 lines
965 B
Bash
Executable File

#!/usr/bin/env bash
#
# **tools/build_venv.sh** - Build a Python Virtual Envirnment
#
# build_venv.sh venv-path [package [...]]
#
# Assumes:
# - a useful pip is installed
# - virtualenv will be installed by pip
# - installs basic common prereq packages that require compilation
# to allow quick copying of resulting venv as a baseline
VENV_DEST=${1:-.venv}
shift
MORE_PACKAGES="$@"
# If TOP_DIR is set we're being sourced rather than running stand-alone
# or in a sub-shell
if [[ -z "$TOP_DIR" ]]; then
set -o errexit
set -o nounset
# Keep track of the devstack directory
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
FILES=$TOP_DIR/files
# Import common functions
source $TOP_DIR/functions
GetDistro
source $TOP_DIR/stackrc
fi
# Build new venv
virtualenv $VENV_DEST
# Install modern pip
PIP_VIRTUAL_ENV=$VENV_DEST pip_install -U pip
# Install additional packages
PIP_VIRTUAL_ENV=$VENV_DEST pip_install ${MORE_PACKAGES}