From 2c5047fde493d64615a46e4f105a9c90d6919d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s=20Rocha?= Date: Wed, 3 Oct 2012 19:02:02 -0400 Subject: [PATCH] Fix create-dev-env script for Mac OS 10.8 and latest stable rvm --- create-dev-env.sh | 126 ++++++++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 54 deletions(-) diff --git a/create-dev-env.sh b/create-dev-env.sh index e7ffadf5f5..e339d0e310 100755 --- a/create-dev-env.sh +++ b/create-dev-env.sh @@ -13,13 +13,13 @@ ouch() { printf '\E[31m' cat< >(tee $LOG) exec 2>&1 @@ -193,7 +193,7 @@ case `uname -s` in maya|lisa|natty|oneiric|precise) output "Installing ubuntu requirements" sudo apt-get -y update - sudo apt-get -y install $APT_PKGS + sudo apt-get -y install $APT_PKGS clone_repos ;; *) @@ -203,11 +203,11 @@ case `uname -s` in esac ;; Darwin) - + if [[ ! -w /usr/local ]]; then cat</dev/null || { + command -v brew &>/dev/null || { output "Installing brew" /usr/bin/ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go) - } + } command -v git &>/dev/null || { output "Installing git" - brew install git + brew install git } clone_repos @@ -241,17 +241,21 @@ EO for pkg in $(cat $BREW_FILE); do grep $pkg <(brew list) &>/dev/null || { output "Installing $pkg" - brew install $pkg + brew install $pkg } done + + # paths where brew likes to install python scripts + PATH=/usr/local/share/python:/usr/local/bin:$PATH + command -v pip &>/dev/null || { output "Installing pip" - sudo easy_install pip + easy_install pip } if ! grep -Eq ^1.7 <(virtualenv --version 2>/dev/null); then output "Installing virtualenv >1.7" - sudo pip install 'virtualenv>1.7' virtualenvwrapper + pip install 'virtualenv>1.7' virtualenvwrapper fi command -v coffee &>/dev/null || { @@ -267,18 +271,10 @@ EO esac output "Installing rvm and ruby" -curl -sL get.rvm.io | bash -s stable +curl -sL get.rvm.io | bash -s -- --version 1.15.7 source $RUBY_DIR/scripts/rvm -# skip the intro +# skip the intro LESS="-E" rvm install $RUBY_VER -if [[ $systempkgs ]]; then - virtualenv --system-site-packages "$PYTHON_DIR" -else - # default behavior for virtualenv>1.7 is - # --no-site-packages - virtualenv "$PYTHON_DIR" -fi -source $PYTHON_DIR/bin/activate output "Installing gem bundler" gem install bundler output "Installing ruby packages" @@ -287,6 +283,16 @@ cd $BASE/mitx || true bundle install cd $BASE +if [[ $systempkgs ]]; then + virtualenv --system-site-packages "$PYTHON_DIR" +else + # default behavior for virtualenv>1.7 is + # --no-site-packages + virtualenv "$PYTHON_DIR" +fi + +# change to mitx python virtualenv +source $PYTHON_DIR/bin/activate if [[ -n $compile ]]; then output "Downloading numpy and scipy" @@ -297,23 +303,36 @@ if [[ -n $compile ]]; then rm -f numpy.tar.gz scipy.tar.gz output "Compiling numpy" cd "$BASE/numpy-${NUMPY_VER}" - python setup.py install + python setup.py install output "Compiling scipy" cd "$BASE/scipy-${SCIPY_VER}" - python setup.py install + python setup.py install cd "$BASE" rm -rf numpy-${NUMPY_VER} scipy-${SCIPY_VER} fi +case `uname -s` in + Darwin) + # on mac os x get the latest distribute and pip + curl http://python-distribute.org/distribute_setup.py | python + pip install -U pip + # need latest pytz before compiling numpy and scipy + pip install -U pytz + pip install numpy + # fixes problem with scipy on 10.8 + pip install -e git+https://github.com/scipy/scipy#egg=scipy-dev + ;; +esac + output "Installing MITx pre-requirements" -pip install -r mitx/pre-requirements.txt +pip install -r mitx/pre-requirements.txt # Need to be in the mitx dir to get the paths to local modules right output "Installing MITx requirements" cd mitx -pip install -r requirements.txt +pip install -r requirements.txt output "Installing askbot requirements" -pip install -r askbot/askbot_requirements.txt -pip install -r askbot/askbot_requirements_dev.txt +pip install -r askbot/askbot_requirements.txt +pip install -r askbot/askbot_requirements_dev.txt mkdir "$BASE/log" || true @@ -322,14 +341,14 @@ mkdir "$BASE/db" || true cat< - $ rake django-admin[runserver,lms,dev,] + $ rake django-admin[runserver,lms,dev,] - If the Django development server starts properly you + If the Django development server starts properly you should see: Development server is running at http://127.0.0.1:/ Quit the server with CONTROL-C. - Connect your browser to http://127.0.0.1: to + Connect your browser to http://127.0.0.1: to view the Django site. END exit 0 -