Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
Merge branch 'mahilleb/pr1461' into mahilleb/Feb17
Browse files Browse the repository at this point in the history
  • Loading branch information
mahilleb-msft committed Feb 21, 2017
2 parents 6d93b4c + 99c0015 commit a11222a
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions Scripts/install/linux/install-cntk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,54 @@
# for full license information.
# ==============================================================================

SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"

PARSED_ARGS=$(getopt -o '' --long py-version:,anaconda-basepath: -n "$SCRIPT_NAME" -- "$@")

[ $? != 0 ] && {
echo Terminating...
exit 1
}

eval set -- "$PARSED_ARGS"
PY_VERSION=35
ANACONDA_PREFIX="$HOME/anaconda3"

while [ $# -gt 0 ]; do
while true; do
case "$1" in
--py-version)
case "$2" in
27 | 34 | 35)
PY_VERSION="$2"
;;
*)
echo Invalid or missing value for --py-version option, please specify 27, 34, or 35.
echo Invalid value for --py-version option, please specify 27, 34, or 35.
exit 1
;;
esac
shift # extra shift
shift 2
;;
*)
echo Unknown option $1
exit 1
--anaconda-basepath)
ANACONDA_PREFIX="$2"
shift 2
;;
--)
shift
break
;;
esac
shift
done

[ $# = 0 ] || {
echo Extra parameters detected: $*
exit 1
}

# Log steps, stop on error
# TODO cut down on logging
set -x -e -o pipefail

SCRIPT_DIR="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"

# Go to the drop root
cd "$SCRIPT_DIR/../../.."

Expand All @@ -51,7 +69,7 @@ CNTK_BINARY="$CNTK_BIN_PATH/cntk"
CNTK_PY_ENV_FILE="$SCRIPT_DIR/conda-linux-cntk-py$PY_VERSION-environment.yml"
CNTK_WHEEL_PATH="cntk/python/cntk-2.0.beta11.0-$PYWHEEL_QUALIFIER-linux_x86_64.whl"

test -d "$CNTK_BIN_PATH" && test -d "$CNTK_LIB_PATH" && test -d "$CNTK_DEP_LIB_PATH" &&
test -d "$CNTK_BIN_PATH" && test -d "$CNTK_LIB_PATH" && test -d "$CNTK_DEP_LIB_PATH" &&
test -d "$CNTK_TUTORIALS_PATH" &&
test -d "$CNTK_EXAMPLES_PATH" && test -x "$CNTK_BINARY" &&
test -f "$CNTK_PY_ENV_FILE" && test -f "$CNTK_WHEEL_PATH" || {
Expand Down Expand Up @@ -122,7 +140,6 @@ fi
# Anaconda install and environment setup
# TODO consider miniconda

ANACONDA_PREFIX="$HOME/anaconda3"
if [ -d "$ANACONDA_PREFIX" ]; then
printf "Path '%s' already exists, skipping Anaconda install\n" "$ANACONDA_PREFIX"
else
Expand All @@ -135,11 +152,11 @@ else
"./$ANACONDA" -b -p "$ANACONDA_PREFIX"
fi

CONDA="$HOME/anaconda3/bin/conda"
CONDA="$ANACONDA_PREFIX/bin/conda"
[ -x "$CONDA" ]
PY_ACTIVATE="$HOME/anaconda3/bin/activate"
PY_ACTIVATE="$ANACONDA_PREFIX/bin/activate"
[ -x "$PY_ACTIVATE" ]
PY_DEACTIVATE="$HOME/anaconda3/bin/deactivate"
PY_DEACTIVATE="$ANACONDA_PREFIX/bin/deactivate"
[ -x "$PY_DEACTIVATE" ]

CNTK_PY_ENV_NAME="cntk-py$PY_VERSION"
Expand Down

0 comments on commit a11222a

Please sign in to comment.