Make use of the $POEZIO_VENV and $POEZIO_VENV_COMMAND env variables if they exist

(instead of having the user edit the scripts to tailor it to their
needs)
This commit is contained in:
mathieui 2015-01-15 16:46:51 +01:00
parent a4771623a5
commit 0efdcd12e2
No known key found for this signature in database
GPG key ID: C59F84CEEFD616E3
2 changed files with 22 additions and 12 deletions

View file

@ -1,6 +1,9 @@
#!/bin/sh #!/bin/sh
poezio_dir=$(dirname "$0") poezio_dir=$(dirname "$0")
VENV="poezio-venv" if [ -z "$POEZIO_VENV" ]
then
POEZIO_VENV="poezio-venv"
fi
if [ -d "$poezio_dir/.git" ] if [ -d "$poezio_dir/.git" ]
then then
@ -9,9 +12,9 @@ else
args="0.9-dev" args="0.9-dev"
fi fi
if [ -e "$poezio_dir/$VENV" ] if [ -e "$poezio_dir/$POEZIO_VENV" ]
then then
PYTHON3="$poezio_dir/$VENV/bin/python3" PYTHON3="$poezio_dir/$POEZIO_VENV/bin/python3"
else else
echo "" echo ""
echo "WARNING: Not using the up-to-date launch format" echo "WARNING: Not using the up-to-date launch format"

View file

@ -7,8 +7,15 @@
# Use launch.sh to start poezio directly from here # Use launch.sh to start poezio directly from here
cd "$(dirname "$0")" cd "$(dirname "$0")"
VENV="poezio-venv" if [ -z "$POEZIO_VENV" ]
VENV_COMMAND="pyvenv" then
POEZIO_VENV="poezio-venv"
fi
if [ -z "$POEZIO_VENV_COMMAND" ]
then
POEZIO_VENV_COMMAND="pyvenv"
fi
echo 'Updating poezio' echo 'Updating poezio'
git pull origin master || { git pull origin master || {
@ -16,24 +23,24 @@ git pull origin master || {
exit 1 exit 1
} }
if [ -e "$VENV" ] if [ -e "$POEZIO_VENV" ]
then then
# In case of a python version upgrade # In case of a python version upgrade
echo 'Trying to upgrade the virtualenv' 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 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' echo 'Updating the poezio dependencies'
pip install -r requirements.txt --upgrade pip install -r requirements.txt --upgrade
echo 'Updating the poezio plugin dependencies' echo 'Updating the poezio plugin dependencies'
pip install -r requirements-plugins.txt --upgrade pip install -r requirements-plugins.txt --upgrade
else else
echo "Creating the $VENV virtualenv" echo "Creating the $POEZIO_VENV virtualenv"
$VENV_COMMAND "$VENV" $POEZIO_VENV_COMMAND "$POEZIO_VENV"
. "$VENV/bin/activate" . "$POEZIO_VENV/bin/activate"
cd "$VENV" # needed to download slixmpp inside the venv 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 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' echo 'Installing the poezio dependencies using pip'