summaryrefslogtreecommitdiff
path: root/update.sh
blob: bdf1dc771431deaf508a2f683b648da1f0b8f4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# Use this script to download or update all dependencies to their last
# developpement version.
# The dependencies will be located in a virtualenv, so you do not
# need to install them on your system at all.

# Use launch.sh to start poezio directly from here

python3 -c 'import sys;(print("Python 3.4 or newer is required") and exit(1)) if sys.version_info < (3, 4) else exit(0)' || exit 1
cd "$(dirname "$0")"
VENV="poezio-venv"
VENV_COMMAND="pyvenv"

echo 'Updating poezio'
git pull origin master || {
    echo "The script failed to update poezio."
    exit 1
}

if [ -e "$VENV" ]
then
    # In case of a python version upgrade
    echo 'Trying to upgrade the virtualenv'
    $VENV_COMMAND --upgrade "$VENV"

    . "$VENV/bin/activate"
    echo 'Updating the poezio dependencies'
    pip install -r requirements.txt --upgrade
    echo 'Updating the poezio plugin dependencies'
    pip install -r requirements-plugins.txt --upgrade
else
    echo "Creating the $VENV virtualenv"
    $VENV_COMMAND "$VENV"

    . "$VENV/bin/activate"
    cd "$VENV" # needed to download slixmpp inside the venv

    echo 'Installing the poezio dependencies using pip'
    pip install -r "../requirements.txt"
    echo 'Installing the poezio plugin dependencies using pip'
    pip install -r "../requirements-plugins.txt"
    cd ..
fi

make


if [ -e src/slixmpp ]
then
    echo ""
    echo "The update script detected a slixmpp link in src/."
    echo "This is probably due to the old update script, you should delete it"
    echo "so that poezio can use the up-to-date copy inside the poezio-venv directory."
    echo ""
fi