Update prepare_env.sh
This change rewrites a bit the prepare_env.sh script to make the installation process smoother. Change-Id: I486aa78888316548b9e8efdc1775c0b41d6532f0
This commit is contained in:
parent
fe47baae9b
commit
efebf2ad90
@ -1,32 +1,54 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script to setup a Python virtual environment with all the dependencies
|
||||||
|
# installed
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Initialize variables
|
||||||
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
VENV_PATH=${VENV_PATH:-"${BASE_DIR}"/venv-stacklight-tests}
|
||||||
|
FUELQA_GITREF=${FUELQA_GITREF:-stable/8.0}
|
||||||
|
VIRTUALENV_BINARY=$(which virtualenv)
|
||||||
|
|
||||||
pip install -U pip || true
|
if [[ -z "${VIRTUALENV_BINARY}" ]]; then
|
||||||
|
echo 'Cannot find the virtualenv executable!'
|
||||||
VIRTUALENV_EXIST=`dpkg -l | grep python-virtualenv || pip list | grep virtualenv`
|
echo 'You should install it either using pip or you distribution package manager.'
|
||||||
|
exit 1
|
||||||
if [[ -z "${VIRTUALENV_EXIST}" ]]; then
|
|
||||||
echo 'There is no virtualnev'
|
|
||||||
pip install virtualenv || apt-get install python-virtualenv || true
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${VENV_PATH}" ]; then
|
if [ ! -x "$VENV_PATH"/bin/activate ]; then
|
||||||
VENV_PATH="${BASE_DIR}"/venv-stacklight-tests
|
"$VIRTUALENV_BINARY" "$VENV_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
virtualenv "${VENV_PATH}" || true
|
. "$VENV_PATH"/bin/activate
|
||||||
|
|
||||||
. "${VENV_PATH}"/bin/activate
|
# Always upgrade to the latest version of pip
|
||||||
|
pip install -U pip
|
||||||
|
|
||||||
|
# Install fuel-qa in the virtual environment
|
||||||
|
FUELQA_GITREF=${FUELQA_GITREF:-stable/8.0}
|
||||||
|
echo "Checking out fuel-qa/$FUELQA_GITREF"
|
||||||
|
FUELQA_DIR=$(mktemp -d)
|
||||||
|
git clone https://github.com/openstack/fuel-qa.git -- "$FUELQA_DIR"
|
||||||
|
|
||||||
|
pushd "$FUELQA_DIR"
|
||||||
|
git checkout "$FUELQA_GITREF"
|
||||||
|
|
||||||
mkdir tmp && cd tmp
|
cp "${BASE_DIR}"/{MANIFEST.in,setup.py} ./
|
||||||
|
|
||||||
git clone https://github.com/openstack/fuel-qa.git && cd fuel-qa && git checkout stable/8.0 || true
|
python setup.py sdist
|
||||||
|
pip install dist/fuelweb_test*.tar.gz
|
||||||
|
|
||||||
cp "${BASE_DIR}"/MANIFEST.in ./ && cp "${BASE_DIR}"/setup.py ./
|
# Clean up stuff
|
||||||
|
popd
|
||||||
|
rm -rf "$FUELQA_DIR"
|
||||||
|
|
||||||
python setup.py sdist && pip install dist/fuelweb_test*.tar.gz && pip install -r "${BASE_DIR}"/../../requirements.txt
|
# Install project's dependencies
|
||||||
|
pip install -rrequirements.txt
|
||||||
|
|
||||||
cd "${BASE_DIR}" && rm -rf tmp
|
echo
|
||||||
|
echo
|
||||||
|
echo "The setup is now complete."
|
||||||
|
echo "Run this command in your shell to activate your Python virtual environment:"
|
||||||
|
echo " . $VENV_PATH/bin/activate"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user