summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-11-02 20:06:16 +0100
committermathieui <mathieui@mathieui.net>2014-11-02 20:08:31 +0100
commitd98f2dde25daddffd1818a3032ed492067375936 (patch)
treed505f073c5e1914129115546024d2d83b29c3cba
parent5ef948270b12671daf066a6eec844e2f0c489a24 (diff)
downloadpoezio-d98f2dde25daddffd1818a3032ed492067375936.tar.gz
poezio-d98f2dde25daddffd1818a3032ed492067375936.tar.bz2
poezio-d98f2dde25daddffd1818a3032ed492067375936.tar.xz
poezio-d98f2dde25daddffd1818a3032ed492067375936.zip
Make update.sh install the deps in a venv, and use them
simplifies the script and avoid cluttering the poezio/ directory. also fix an unrelated test with slixmpp
-rwxr-xr-xlaunch.sh16
-rw-r--r--test/test_common.py2
-rwxr-xr-xupdate.sh83
3 files changed, 44 insertions, 57 deletions
diff --git a/launch.sh b/launch.sh
index 72dcab7e..73b08eac 100755
--- a/launch.sh
+++ b/launch.sh
@@ -1,5 +1,6 @@
#!/bin/sh
poezio_dir=$(dirname "$0")
+VENV="poezio-venv"
if [ -d "$poezio_dir/.git" ]
then
@@ -7,5 +8,18 @@ then
else
args="0.8.3-dev"
fi
-exec python3 "$poezio_dir/src/poezio.py" -v "$args" "$@"
+
+if [ -e "$poezio_dir/$VENV" ]
+then
+ PYTHON3="$poezio_dir/$VENV/bin/python3"
+else
+ echo ""
+ echo "WARNING: Not using the up-to-date launch format"
+ echo "Run ./update.sh again to create a virtualenv with the deps"
+ echo "(or ignore this message if you don't want to)"
+ echo ""
+ PYTHON3=python3
+fi
+
+exec "$PYTHON3" "$poezio_dir/src/poezio.py" -v "$args" "$@"
diff --git a/test/test_common.py b/test/test_common.py
index 315318bd..50643733 100644
--- a/test/test_common.py
+++ b/test/test_common.py
@@ -8,7 +8,7 @@ sys.path.append('src')
import time
import pytest
import datetime
-from sleekxmpp import JID
+from slixmpp import JID
from datetime import timedelta
from common import (datetime_tuple, get_utc_time, get_local_time, shell_split,
find_argument_quoted, find_argument_unquoted,
diff --git a/update.sh b/update.sh
index ae333108..2a226e38 100755
--- a/update.sh
+++ b/update.sh
@@ -1,70 +1,43 @@
#!/bin/sh
-# Use this script to Download or Update all dependances to their last
+# Use this script to download or update all dependencies to their last
# developpement version.
-# The dependances will be placed in the sources directory, so you do not
+# 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
-error() {
- echo -e "\033[1;31mThe script failed to update $1.\033[0m"
- echo -e "\033[1;31mPlease investigate.\033[0m"
- exit 1
-}
+cd "$(dirname "$0")"
+VENV="poezio-venv"
echo 'Updating poezio'
-git pull origin slix || error poezio
+git pull origin slix || {
+ echo "The script failed to update poezio."
+ exit 1
+}
-make
-if [ $? -ne 0 ]
+if [ -e "$VENV" ]
then
- echo -e "It seems that you do not have the python development"\
- "files.\nSearch for a package named python3-dev or python3-devel"\
- "in your repos."
- exit -1
-fi
+ # In case of a python version upgrade
+ echo 'Trying to upgrade the virtualenv'
+ pyvenv --upgrade "$VENV"
-if [ -e "slixmpp" ]
-then
- echo "Updating slixmpp"
- cd slixmpp
- git pull || error slixmpp
- cd ..
+ source "$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 "Downloading slixmpp"
- git clone git://git.louiz.org/slixmpp || error slixmpp
-fi
+ echo "Creating the $VENV virtualenv"
+ pyvenv "$VENV"
-if [ -e ".dnspython.tgz" ]
-then
- if [ -e "dnspython" ]
- then
- echo "dnspython up to date"
- else
- echo "Restoring dnspython"
- tar xfz .dnspython.tgz
- mv dnspython3-1.10.0 dnspython
- fi
-else
- echo "Downloading dnspython"
- wget -c -q -O .dnspython.tgz http://www.dnspython.org/kits3/1.10.0/dnspython3-1.10.0.tar.gz || error dnspython
- rm -fr dnspython
- tar xfz .dnspython.tgz
- mv dnspython3-1.10.0 dnspython
-fi
+ source "$VENV/bin/activate"
+ cd "$VENV" # needed to download slixmpp inside the venv
-cd src
-if [ -h "dns" ]
-then
- echo 'Link src/dns already exists'
-else
- echo "Creating link src/dns"
- ln -s ../dnspython/dns dns
-fi
-if [ -h "slixmpp" ]
-then
- echo 'Link src/slixmpp already exists'
-else
- echo "Creating link src/slixmpp"
- ln -s ../slixmpp/slixmpp slixmpp
+ 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