You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2014/05/20 16:28:58 UTC

[2/5] git commit: CLIMATE-370 - Add OS X install script

CLIMATE-370 - Add OS X install script

- Add OS X helper install script. Note that this uses the conda
  dependencies file for installation of some of the components. At the
  moment, specific versions aren't grabbed (just the latest versions of
  the components are).


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/41e12989
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/41e12989
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/41e12989

Branch: refs/heads/master
Commit: 41e12989e8bf66eace60b6276e1d65813b545768
Parents: 9353d89
Author: Michael Joyce <jo...@apache.org>
Authored: Mon May 12 10:40:48 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Mon May 19 08:42:04 2014 -0700

----------------------------------------------------------------------
 easy-ocw/install-osx.sh | 184 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 184 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/41e12989/easy-ocw/install-osx.sh
----------------------------------------------------------------------
diff --git a/easy-ocw/install-osx.sh b/easy-ocw/install-osx.sh
new file mode 100755
index 0000000..a45f784
--- /dev/null
+++ b/easy-ocw/install-osx.sh
@@ -0,0 +1,184 @@
+#!/bin/bash
+#
+# PUT HEADER HERE
+
+export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
+
+help()
+{
+cat << ENDHELP
+
+Easy OCW assists with the building of the Apache Open Climate Workbench and its dependencies
+
+Flags:
+    -h  Display this help message.
+    -e  Install and configure a virtualenv environment before installation.
+    -q  Quiet install. User prompts are removed (when possible).
+
+It is recommended that you pass -e when running this script. If you don't, parts
+of this installation will pollute your global Python install. If you're unsure,
+pass -e just to be safe!
+
+ENDHELP
+}
+
+header()
+{
+    echo
+    echo $1
+}
+
+task()
+{
+    echo " - " $1
+}
+
+subtask()
+{
+    echo "     " $1
+}
+
+echo
+echo "---------------------------------------------------------------------------"
+echo "                         Welcome to Easy OCW"
+echo "---------------------------------------------------------------------------"
+echo
+
+WITH_VIRTUAL_ENV=0
+WITH_HOMEBREW=0
+WITH_INTERACT=1
+
+while getopts ":h :e :q" FLAG
+do
+    case $FLAG in
+        h)
+            help
+            exit 1
+            ;;
+        e)
+            WITH_VIRTUAL_ENV=1
+            ;;
+        q)
+            WITH_INTERACT=0
+            ;;
+        ?)
+            help
+            exit 1
+            ;;
+    esac
+done
+
+if [ $WITH_INTERACT == 1 ]; then
+cat << ENDINTRO
+A number of dependencies for OCW will now be installed. Please check the wiki
+for a complete list of dependencies. Additionally, please read the wiki for
+useful installation guidelines and information that may be pertinent to your
+situation.
+
+ENDINTRO
+
+if [ $WITH_VIRTUAL_ENV != 1 ]; then
+cat << VIRTUALENV_WARNING
+It is highly recommended that you allow Easy OCW to install the dependencies
+into a virtualenv environment to ensure that your global Python install is
+not affected. If you're unsure, you should pass the -e flag
+to this script. If you aren't concerned, or you want to create your own
+virtualenv environment, then feel free to ignore this message.
+
+VIRTUALENV_WARNING
+fi
+
+read -p "Press [ENTER] to begin installation ..."
+fi
+
+header "Checking for pip ..."
+if [ ! command -v pip >/dev/null 2>&1 ]; then
+    task "Unable to locate pip."
+    task "Installing Distribute"
+    curl http://python-distribute.org/distribute_setup.py | python >> install_log
+    subtask "done"
+
+    task "Installing Pip"
+    curl -O http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz >> install_log
+    tar xzf pip-1.2.1.tar.gz >> install_log
+    cd pip-1.2.1/
+    python setup.py install >> install_log
+    subtask "done"
+fi
+
+if [ $WITH_VIRTUAL_ENV == 1 ]; then
+    header "Setting up a virtualenv ..."
+
+    # Check if virtualenv is installed. If it's not, we'll install it for the user.
+    if ! command -v virtualenv >/dev/null 2>&1; then
+        task "Installing virtualenv ..."
+        pip install virtualenv >> install_log
+        subtask "done"
+    fi
+
+    # Check if virtualenvwrapper is installed or not. If it's not, we'll
+    # install it for the user. Why wouldn't you want to use virtualenvwrapper?!?!
+    # It's super awesome! By default, virtualenvwrapper installs to the same place
+    # as virtualenv so we'll look for the necessary scripts there. This is fairly
+    # brittle, but it should be sufficient for the majority of cases.
+    virtualEnvLoc=`which virtualenv`
+    virtualEnvWrapperLoc="${virtualEnvLoc}wrapper.sh"
+
+    if [ ! -f $virtualEnvWrapperLoc ]; then
+        task "Installing virtualenvwrapper ..."
+        pip install virtualenvwrapper >> install_log
+        subtask "done"
+
+        task "Setting/sourcing necessary virtualenv things ..."
+        # Need to setup environment for virtualenv
+        export WORKON_HOME=$HOME/.virtualenvs
+        subtask "done"
+    fi
+
+    # Just to be safe, we'll source virtualenvwrapper. This is really only
+    # necessary if we installed it for the user.
+    source $virtualEnvWrapperLoc
+
+    # Create a new environment for OCW work
+    task "Creating a new environment ..."
+    mkvirtualenv ocw >> install_log
+    workon ocw >> install_log
+    subtask "done"
+fi
+
+header "Installing conda for package management ..."
+
+pip install conda >> install_log
+conda init >> install_log
+
+
+header "Installing dependencies with conda ..."
+echo | conda install --file ocw-conda-dependencies.txt
+
+# We only use conda for the annoying dependencies like numpy,
+# scipy, matplotlib, and basemap. For everything else, we stick
+# with pip.
+header "Installing additional Python packages"
+task "Installing requests ..."
+pip install requests >> install_log
+subtask "done"
+
+task "Installing bottle ..."
+pip install bottle >> install_log
+subtask "done"
+
+task "Installing pydap ..."
+pip install pydap >> install_log
+subtask "done"
+
+task "Installing webtest ..."
+pip install webtest >> install_log
+subtask "done"
+
+task "Installing nose ..."
+pip install nose >> install_log
+subtask "done"
+
+task "Installing pylint ..."
+pip install pylint >> install_log
+subtask "done"