testing: detect missing virtualenv differently (
bug 1357201); r?glob
A consequence of adding new virtualenvs under venv/* is that venv/
may exist before ./create-{deploy,test}-environment is run. This was
throwing off virtualenv presence detection in the existing scripts.
We change the scripts to look for ${VENV}/lib instead. In addition,
a `mkdir` was changed to `mkdir -p` so the command won't fail if the
directory exists.
MozReview-Commit-ID: EedvaSPgsTp
--- a/create-deploy-environment
+++ b/create-deploy-environment
@@ -1,16 +1,16 @@
#!/usr/bin/env bash
# Bail on any setup error
set -eu
ROOT=`pwd`
VENV=${ROOT}/venv
-if [ ! -d ${VENV} ]; then
+if [ ! -d ${VENV}/lib ]; then
. ${ROOT}/testing/create-virtualenv
fi
cd ${ROOT}
# activate fails on read of PS1, which doesn't exist in non-interactive shell
set +u
source ${VENV}/bin/activate
--- a/create-test-environment
+++ b/create-test-environment
@@ -56,17 +56,17 @@ if ! type msgfmt >/dev/null 2>&1; then
echo "On OSX you can use homebrew to install this:"
echo " brew install gettext && brew link gettext --force"
exit 1
fi
ROOT=`pwd`
VENV=${ROOT}/venv
-if [ ! -d ${VENV} ]; then
+if [ ! -d ${VENV}/lib ]; then
# There is a bug in pycrypto where it tries to invoke `configure` instead
# of a path qualified configure. So if there is a "configure" on $PATH
# it will invoke the wrong one.
configure=which configure &>/dev/null || true
if [ "x" != "x${configure}" ]; then
echo "configure in PATH; pycrypto install will fail!"
echo "Remove the path containing ${configure} from PATH"
exit 1
--- a/testing/create-virtualenv
+++ b/testing/create-virtualenv
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
-mkdir ${VENV}
+mkdir -p ${VENV}
# Securely download virtualenv, setuptools, and pip.
${ROOT}/scripts/download-verify https://s3-us-west-2.amazonaws.com/moz-packages/virtualenv-15.1.0.tar.gz \
${VENV}/virtualenv-15.1.0.tar.gz \
02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a && \
cd ${VENV} && tar -xzf virtualenv-15.1.0.tar.gz && \
rm -f ${VENV}/virtualenv-15.1.0/virtualenv_support/setuptools-28.8.0-py2.py3-none-any.whl \
${VENV}/virtualenv-15.1.0/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl