diff --git a/run.sh b/run.sh index 045b07c0fafc..8453587280e9 100755 --- a/run.sh +++ b/run.sh @@ -56,11 +56,12 @@ done # If there is a .venv/ directory, assume it contains a virtualenv that we # should run this instance in. -if [ -d .venv -a -z "$skip_venv" ]; +GALAXY_VIRTUAL_ENV="${GALAXY_VIRTUAL_ENV:-.venv}" +if [ -d "$GALAXY_VIRTUAL_ENV" -a -z "$skip_venv" ]; then [ -n "$PYTHONPATH" ] && { echo 'Unsetting $PYTHONPATH'; unset PYTHONPATH; } - printf "Activating virtualenv at %s/.venv\n" $(pwd) - . .venv/bin/activate + printf "Activating virtualenv at $GALAXY_VIRTUAL_ENV\n" + . "$GALAXY_VIRTUAL_ENV/bin/activate" fi # If you are using --skip-venv we assume you know what you are doing but warn diff --git a/run_tests.sh b/run_tests.sh index 50a64e86c3f6..c4cf50e493a1 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -329,10 +329,11 @@ if [ -z "$skip_common_startup" ]; then ./scripts/common_startup.sh $skip_venv $no_create_venv $no_replace_pip $replace_pip --dev-wheels || exit 1 fi -if [ -z "$skip_venv" -a -d .venv ]; +GALAXY_VIRTUAL_ENV="${GALAXY_VIRTUAL_ENV:-.venv}" +if [ -z "$skip_venv" -a -d "$GALAXY_VIRTUAL_ENV" ]; then - printf "Activating virtualenv at %s/.venv\n" $(pwd) - . .venv/bin/activate + printf "Activating virtualenv at $GALAXY_VIRTUAL_ENV\n" + . "$GALAXY_VIRTUAL_ENV/bin/activate" fi if [ -n "$migrated_test" ] ; then diff --git a/scripts/common_startup.sh b/scripts/common_startup.sh index 55fb7b94113e..bb5fd8243d18 100755 --- a/scripts/common_startup.sh +++ b/scripts/common_startup.sh @@ -66,14 +66,16 @@ if [ ! -f $GALAXY_CONFIG_FILE ]; then GALAXY_CONFIG_FILE=config/galaxy.ini.sample fi +: ${GALAXY_VIRTUAL_ENV:=.venv} + if [ $SET_VENV -eq 1 -a $CREATE_VENV -eq 1 ]; then # If .venv does not exist, attempt to create it. - if [ ! -d .venv ] + if [ ! -d "$GALAXY_VIRTUAL_ENV" ] then # Ensure Python is a supported version before creating .venv python ./scripts/check_python.py || exit 1 if command -v virtualenv >/dev/null; then - virtualenv .venv + virtualenv "$GALAXY_VIRTUAL_ENV" else vvers=13.1.2 vurl="https://pypi.python.org/packages/source/v/virtualenv/virtualenv-${vvers}.tar.gz" @@ -98,7 +100,7 @@ if [ $SET_VENV -eq 1 -a $CREATE_VENV -eq 1 ]; then python -c "import hashlib; assert hashlib.sha256(open('$vsrc', 'rb').read()).hexdigest() == '$vsha', '$vsrc: invalid checksum'" fi tar zxf $vsrc -C $vtmp - python $vtmp/virtualenv-$vvers/virtualenv.py .venv + python $vtmp/virtualenv-$vvers/virtualenv.py "$GALAXY_VIRTUAL_ENV" rm -rf $vtmp fi fi @@ -107,10 +109,10 @@ fi if [ $SET_VENV -eq 1 ]; then # If there is a .venv/ directory, assume it contains a virtualenv that we # should run this instance in. - if [ -d .venv ]; + if [ -d "$GALAXY_VIRTUAL_ENV" ]; then - printf "Activating virtualenv at %s/.venv\n" $(pwd) - . .venv/bin/activate + printf "Activating virtualenv at $GALAXY_VIRTUAL_ENV\n" + . "$GALAXY_VIRTUAL_ENV/bin/activate" # Because it's a virtualenv, we assume $PYTHONPATH is unnecessary for # anything in the venv to work correctly, and having it set can cause # problems when there are conflicts with Galaxy's dependencies outside @@ -122,7 +124,7 @@ if [ $SET_VENV -eq 1 ]; then fi if [ -z "$VIRTUAL_ENV" ]; then - echo "ERROR: A virtualenv cannot be found. Please create a virtualenv in .venv, or activate one." + echo "ERROR: A virtualenv cannot be found. Please create a virtualenv in $GALAXY_VIRTUAL_ENV, or activate one." exit 1 fi fi