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 $PIP_OPTIONS install --pre python-musicpd || exit 1
42 SIMA_LAUNCHER=$(readlink -f $(dirname $0))/launch
43 SIMA_VLAUNCHER=$(readlink -f $(dirname $0))/vlaunch
44 [ -x "$SIMA_LAUNCHER" ] || { echo "$SIMA_LAUNCHER not available"; exit 1; }
46 cat << EOF > $SIMA_VLAUNCHER
48 . $INSTALL_DIR/venv/bin/activate
49 python $SIMA_LAUNCHER "\$@"
51 chmod +x $SIMA_VLAUNCHER
55 # vim: fileencoding=utf8