Verified Commit d98f2dde authored by mathieui's avatar mathieui

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
parent 5ef94827
#!/bin/sh #!/bin/sh
poezio_dir=$(dirname "$0") poezio_dir=$(dirname "$0")
VENV="poezio-venv"
if [ -d "$poezio_dir/.git" ] if [ -d "$poezio_dir/.git" ]
then then
...@@ -7,5 +8,18 @@ then ...@@ -7,5 +8,18 @@ then
else else
args="0.8.3-dev" args="0.8.3-dev"
fi 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" "$@"
...@@ -8,7 +8,7 @@ sys.path.append('src') ...@@ -8,7 +8,7 @@ sys.path.append('src')
import time import time
import pytest import pytest
import datetime import datetime
from sleekxmpp import JID from slixmpp import JID
from datetime import timedelta from datetime import timedelta
from common import (datetime_tuple, get_utc_time, get_local_time, shell_split, from common import (datetime_tuple, get_utc_time, get_local_time, shell_split,
find_argument_quoted, find_argument_unquoted, find_argument_quoted, find_argument_unquoted,
......
#!/bin/sh #!/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. # 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. # need to install them on your system at all.
# Use launch.sh to start poezio directly from here # Use launch.sh to start poezio directly from here
error() { cd "$(dirname "$0")"
echo -e "\033[1;31mThe script failed to update $1.\033[0m" VENV="poezio-venv"
echo -e "\033[1;31mPlease investigate.\033[0m"
exit 1
}
echo 'Updating poezio' echo 'Updating poezio'
git pull origin slix || error poezio git pull origin slix || {
echo "The script failed to update poezio."
exit 1
}
make if [ -e "$VENV" ]
if [ $? -ne 0 ]
then then
echo -e "It seems that you do not have the python development"\ # In case of a python version upgrade
"files.\nSearch for a package named python3-dev or python3-devel"\ echo 'Trying to upgrade the virtualenv'
"in your repos." pyvenv --upgrade "$VENV"
exit -1
fi
if [ -e "slixmpp" ] source "$VENV/bin/activate"
then echo 'Updating the poezio dependencies'
echo "Updating slixmpp" pip install -r requirements.txt --upgrade
cd slixmpp echo 'Updating the poezio plugin dependencies'
git pull || error slixmpp pip install -r requirements-plugins.txt --upgrade
cd ..
else else
echo "Downloading slixmpp" echo "Creating the $VENV virtualenv"
git clone git://git.louiz.org/slixmpp || error slixmpp pyvenv "$VENV"
fi
if [ -e ".dnspython.tgz" ] source "$VENV/bin/activate"
then cd "$VENV" # needed to download slixmpp inside the venv
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
cd src echo 'Installing the poezio dependencies using pip'
if [ -h "dns" ] pip install -r "../requirements.txt"
then echo 'Installing the poezio plugin dependencies using pip'
echo 'Link src/dns already exists' pip install -r "../requirements-plugins.txt"
else cd ..
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
fi fi
make
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment