summaryrefslogtreecommitdiff
path: root/update.sh
diff options
context:
space:
mode:
Diffstat (limited to 'update.sh')
-rwxr-xr-xupdate.sh38
1 files changed, 28 insertions, 10 deletions
diff --git a/update.sh b/update.sh
index 3203d506..bacd502d 100755
--- a/update.sh
+++ b/update.sh
@@ -7,32 +7,50 @@
# Use launch.sh to start poezio directly from here
cd "$(dirname "$0")"
-VENV="poezio-venv"
-VENV_COMMAND="pyvenv"
+if [ -z "$POEZIO_VENV" ]
+then
+ POEZIO_VENV="poezio-venv"
+fi
+
+if [ -z "$POEZIO_VENV_COMMAND" ]
+then
+ POEZIO_VENV_COMMAND="pyvenv"
+fi
+command -v $POEZIO_VENV_COMMAND > /dev/null 2>&1 || {
+ echo "'$POEZIO_VENV_COMMAND' executable not found. Check that you have python (>= 3.4) installed,"
+ echo " and that \$POEZIO_VENV_COMMAND points to a valid virtualenv command."
+ if [ "$POEZIO_VENV_COMMAND" = 'pyvenv' ]; then
+ echo "If your distribution does not provide a 'pyvenv' command, maybe it has another name, like 'pyvenv-3.4'"
+ echo 'Set the $POEZIO_VENV_COMMAND env variable to the name of that executable and this script will use it.'
+ fi
+ exit 1
+}
echo 'Updating poezio'
-git pull origin slix || {
+git pull origin master || {
echo "The script failed to update poezio."
exit 1
}
-if [ -e "$VENV" ]
+if [ -e "$POEZIO_VENV" ]
then
# In case of a python version upgrade
echo 'Trying to upgrade the virtualenv'
- $VENV_COMMAND --upgrade "$VENV"
+ $POEZIO_VENV_COMMAND --upgrade "$POEZIO_VENV"
- . "$VENV/bin/activate"
+ . "$POEZIO_VENV/bin/activate"
+ 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
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"
+ echo "Creating the $POEZIO_VENV virtualenv"
+ $POEZIO_VENV_COMMAND "$POEZIO_VENV"
- . "$VENV/bin/activate"
- cd "$VENV" # needed to download slixmpp inside the venv
+ . "$POEZIO_VENV/bin/activate"
+ cd "$POEZIO_VENV" # needed to download slixmpp inside the venv
+ 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
echo 'Installing the poezio dependencies using pip'
pip install -r "../requirements.txt"