53_pymsc.sh 813 Bytes
Newer Older
1 2 3 4
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh

5
# Setup pymsc in ~/.local
6
cd $DIR/../pymsc || exit 1
7 8

# Skip install if the version installed is the same and the tree is clean
Maxime Perrotin's avatar
Maxime Perrotin committed
9
HEAD="$(grep __version msccore/__init__.py | awk '{print $NF}' | tr -d '"')"
10 11 12 13

VERSION_INSTALLED="$(pip2 freeze | grep taste-msc | awk -F= '{print $NF}')"
git status >/dev/null
TREE_CLEAN=$?
Maxime Perrotin's avatar
Maxime Perrotin committed
14
if [ ${TREE_CLEAN} -eq 0 -a "${HEAD}" == "${VERSION_INSTALLED}" ] ; then
15 16 17 18 19 20 21
    echo taste-msc tree is clean and already installed. Skipping taste-msc install...
    exit 0
fi

# Unfortunately, the --upgrade DOES NOT ALWAYS WORK.
# Uninstall first...
echo y | pip2 uninstall taste-msc
22
pip2 install --user --upgrade . || exit 1
23 24 25 26

# Add .local/bin to PATH
PATH_CMD='export PATH=$PATH:$HOME/.local/bin'
UpdatePATH