5 # version: 0.2 : Date: 2013/11/13
9 DEBUG=${DEBUG:-"0"} # Set to 1 in order to enable DEBUG message.
10 ## Use "export DEBUG=1" in the calling script to enable it
12 # >$ DEBUG=1 script_name.sh
13 ## Only error message will be printed with DEBUG="0"
16 PY3=${PY3:-$(which python3)}
18 # Test virtualenv presence
19 [ -x "$(which virtualenv)" ] || { echo "Cannot find virtualenv executable!"; exit 1; }
20 [ -x "$(which ${PY3})" ] || { echo "Cannot find a python3.3 interpreter!"; exit 1; }
21 [ "$DEBUG" != "0" ] && echo "python: $PY3"
23 INSTALL_DIR=${INSTALL_DIR:-$(dirname $0)}
25 INSTALL_DIR=$(readlink -f ${INSTALL_DIR})
26 [ "$DEBUG" != "0" ] && echo "install dir: $INSTALL_DIR"
28 VENV_OPTIONS="--python=$PY3 --prompt="sima_venv" --no-site-packages --clear"
29 [ "$DEBUG" = "0" ] && VENV_OPTIONS="$VENV_OPTIONS --quiet"
31 virtualenv $VENV_OPTIONS $INSTALL_DIR/venv || { echo "something went wrong generating virtualenv"; exit 1; }
33 . $INSTALL_DIR/venv/bin/activate
36 [ "$DEBUG" = "0" ] && PIP_OPTIONS="$PIP_OPTIONS --quiet"
38 pip install -e . || exit 1
40 echo Installing mpd-sima
41 $(dirname $0)/setup.py --quiet install || exit 1
45 SIMA_LAUNCHER=mpd-sima
46 SIMA_VLAUNCHER=$INSTALL_DIR/vmpd-sima
48 cat << EOF > "$SIMA_VLAUNCHER"
50 . $INSTALL_DIR/venv/bin/activate
51 $INSTALL_DIR/$SIMA_LAUNCHER "\$@"
53 chmod +x $SIMA_VLAUNCHER
56 rm -rf $(dirnddame $0)/dist
57 rm -rf $(dirname $0)/build
58 rm -rf $(dirname $0)/sima.egg-info
62 # vim: fileencoding=utf8