Skip to content

Commit

Permalink
upgrade_db.sh: fix locating of python binary
Browse files Browse the repository at this point in the history
This fixes two bugs:

upgrade fails when deps were installed to virtualenv but not system
upgrade fails when python==python3 (notably on arch)

Signed-off-by: Thomas Stilwell <[email protected]>
  • Loading branch information
benemorius committed Sep 8, 2014
1 parent 5fb0875 commit 272d11d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion upgrade_db.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
#!/bin/bash

PYTHON="./env/bin/python"
if [ ! -x $PYTHON ]; then
echo "No python executable found at ${PYTHON}"
if type python2 &>/dev/null; then
PYTHON=python2
elif type python &>/dev/null; then
PYTHON=python
else
echo "No python executable found anywhere"
exit
fi
fi

# Execute from root dir as: bash upgrade_db.sh <db_path>
for file in db/migrations/*
do
python $file $1 upgrade
$PYTHON $file $1 upgrade
done

0 comments on commit 272d11d

Please sign in to comment.