5 # version: 0.0 : Date: 1970/01/01 00:0:00
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.3)}
17 MUSICPD="http://media.kaliko.me/src/musicpd/dist/python-musicpd-0.3.1.tar.bz2"
19 # Test virtualenv presence
20 [ -x "$(which virtualenv)" ] || { echo "Cannot find virtualenv executable!"; exit 1; }
21 [ -x "$(which ${PY3})" ] || { echo "Cannot find a python3.3 interpreter!"; exit 1; }
22 [ "$DEBUG" != "0" ] && echo "python: $PY3"
24 INSTALL_DIR=${INSTALL_DIR:-$(dirname $0)}
26 INSTALL_DIR=$(readlink -f ${INSTALL_DIR})
27 [ "$DEBUG" != "0" ] && echo "install dir: $INSTALL_DIR"
29 VENV_OPTIONS="--python=$PY3 --prompt="sima_venv" --no-site-packages --clear"
30 [ "$DEBUG" = "0" ] && VENV_OPTIONS="$VENV_OPTIONS --quiet"
32 virtualenv $VENV_OPTIONS $INSTALL_DIR/venv || { echo "something went wrong generating virtualenv"; exit 1; }
34 . $INSTALL_DIR/venv/bin/activate
37 [ "$DEBUG" = "0" ] && PIP_OPTIONS="$PIP_OPTIONS --quiet"
39 pip $PIP_OPTIONS install $MUSICPD
43 SIMA_LAUNCHER=$(readlink -f $(dirname $0))/launch
44 SIMA_VLAUNCHER=$(readlink -f $(dirname $0))/vlaunch
45 [ -x "$SIMA_LAUNCHER" ] || { echo "$SIMA_LAUNCHER not available"; exit 1; }
47 cat << EOF > $SIMA_VLAUNCHER
49 . $INSTALL_DIR/venv/bin/activate
50 python $SIMA_LAUNCHER $@
52 chmod +x $SIMA_VLAUNCHER
56 # vim: fileencoding=utf8