Skip to content

Commit

Permalink
Add support for fish shell when running mk-venv (#425)
Browse files Browse the repository at this point in the history
* Add support for fish shell

Add $PROVIDERPATH to activate.fish so that people using this shell can
contribute to Checkbox as well.

* Display correct command to run when using fish

* Apply shellcheck suggestions to mk-venv
  • Loading branch information
pieqq committed Apr 13, 2023
1 parent c678dfc commit c2b08dc
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions checkbox-ng/mk-venv
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,29 @@

venv_path=${1:-venv}

venv_path=$(realpath $venv_path)
venv_path=$(realpath "$venv_path")

if [ -d $venv_path ]; then
if [ -d "$venv_path" ]; then
echo "$venv_path already exists"
exit 1
fi

virtualenv --quiet --system-site-packages --python=python3 $venv_path
virtualenv --quiet --system-site-packages --python=python3 "$venv_path"

. $venv_path/bin/activate
# To prevent https://www.shellcheck.net/wiki/SC1091
# shellcheck source=/dev/null
. "$venv_path"/bin/activate
python3 setup.py develop --quiet | sed -e 's/^/I (develop output) /'
pip install tqdm psutil

mkdir -p "$venv_path/share/plainbox-providers-1"
echo "export PROVIDERPATH=$venv_path/share/plainbox-providers-1" >> $venv_path/bin/activate
echo "export PROVIDERPATH=$venv_path/share/plainbox-providers-1" >> "$venv_path"/bin/activate
echo "set -gx PROVIDERPATH $venv_path/share/plainbox-providers-1" >> "$venv_path"/bin/activate.fish

echo "virtualenv with an empty provider database created at $venv_path"
echo "To activate your virtualenv run:"
echo "$ . $venv_path/bin/activate"

if [ "$(basename "$SHELL")" = "fish" ]; then
echo "$ . $venv_path/bin/activate.fish"
else
echo "$ . $venv_path/bin/activate"
fi

0 comments on commit c2b08dc

Please sign in to comment.