poezio/launch.sh
kaliko 262583133e Dereference potential linked launch.sh file
It can be useful to have launch.sh linked somewhere outside the
repository clone. For instance to expose launch.sh in the $PATH.

Exposing launch.sh with a symbolic link outside the git repository
breaks poezio execution through launch.sh. “ cd dirname "$0" ” will get
to the directory holding the link and not within the git repository.
2021-01-30 11:01:20 +01:00

29 lines
708 B
Bash
Executable file

#!/bin/sh
cd $(dirname "$(readlink -f "$0")")
if [ -z "$POEZIO_VENV" ]
then
POEZIO_VENV="poezio-venv"
fi
if [ -e .git ]
then
args=$(git show --format='%h %ci' | head -n1)
else
args="0.13.1-dev"
fi
if [ -e "$POEZIO_VENV" ]
then
PYTHON3="$POEZIO_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
$PYTHON3 -c 'import sys;(print("Python 3.7 or newer is required") and exit(1)) if sys.version_info < (3, 7) else exit(0)' || exit 1
exec "$PYTHON3" -m poezio --custom-version "$args" "$@"