8c2ce6ea |
#!/usr/bin/env bash
#
# **tools/build_venv.sh** - Build a Python Virtual Envirnment
#
# build_venv.sh venv-path [package [...]]
# |
dc97cb71 |
# Installs basic common prereq packages that require compilation
# to allow quick copying of resulting venv as a baseline
# |
8c2ce6ea |
# Assumes:
# - a useful pip is installed
# - virtualenv will be installed by pip
VENV_DEST=${1:-.venv}
shift
MORE_PACKAGES="$@"
|
dc97cb71 |
# If ``TOP_DIR`` is set we're being sourced rather than running stand-alone |
8c2ce6ea |
# or in a sub-shell
if [[ -z "$TOP_DIR" ]]; then
set -o errexit
set -o nounset
|
dc97cb71 |
# Keep track of the DevStack directory |
8c2ce6ea |
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 |
99c463d5 |
PIP_VIRTUAL_ENV=$VENV_DEST pip_install -U pip |
8c2ce6ea |
|
99c463d5 |
# Install additional packages
PIP_VIRTUAL_ENV=$VENV_DEST pip_install ${MORE_PACKAGES} |