Commit 61ca49ac by Nate Hardison

Adding a check for an existing virtualenv

This way, packages won't be inadvertently installed into the wrong
virtual environment. I tried to have the check just run `deactivate`,
but I couldn't figure out how to get that working, so the script
just bails.
parent a3bb4bfb
...@@ -92,6 +92,7 @@ clone_repos() { ...@@ -92,6 +92,7 @@ clone_repos() {
fi fi
} }
### START ### START
PROG=${0##*/} PROG=${0##*/}
...@@ -99,9 +100,9 @@ PROG=${0##*/} ...@@ -99,9 +100,9 @@ PROG=${0##*/}
# Adjust this to wherever you'd like to place the codebase # Adjust this to wherever you'd like to place the codebase
BASE="${PROJECT_HOME:-$HOME}/mitx_all" BASE="${PROJECT_HOME:-$HOME}/mitx_all"
# Use a sensible default (~/.virtualenv) for your Python virtualenvs # Use a sensible default (~/.virtualenvs) for your Python virtualenvs
# unless you've already got one set up with virtualenvwrapper. # unless you've already got one set up with virtualenvwrapper.
PYTHON_DIR=${WORKON_HOME:-"$HOME/.virtualenv"} PYTHON_DIR=${WORKON_HOME:-"$HOME/.virtualenvs"}
# RVM defaults its install to ~/.rvm, but use the overridden rvm_path # RVM defaults its install to ~/.rvm, but use the overridden rvm_path
# if that's what's preferred. # if that's what's preferred.
...@@ -116,7 +117,14 @@ if [[ $EUID -eq 0 ]]; then ...@@ -116,7 +117,14 @@ if [[ $EUID -eq 0 ]]; then
exit 1 exit 1
fi fi
# TODO: test for an existing virtualenv # If in an existing virtualenv, bail
if [[ "x$VIRTUAL_ENV" != "x" ]]; then
envname=`basename $VIRTUAL_ENV`
error "Looks like you're already in the \"$envname\" virtual env."
error "Run \`deactivate\` and then re-run this script."
usage
exit 1
fi
# Read arguments # Read arguments
ARGS=$(getopt "cvhs" "$*") ARGS=$(getopt "cvhs" "$*")
...@@ -281,8 +289,6 @@ fi ...@@ -281,8 +289,6 @@ fi
# See `rvm requirements` for more information. # See `rvm requirements` for more information.
case `uname -s` in case `uname -s` in
Darwin) Darwin)
# TODO (Nate): test to see if CC is already set to gcc or something
# similar first (not clang).
export CC=gcc export CC=gcc
;; ;;
esac esac
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment