Skip to content

Commit

Permalink
Merge pull request #3718 from dokku/3714-python-support
Browse files Browse the repository at this point in the history
Detect correct python binary to use
  • Loading branch information
josegonzalez committed Oct 18, 2019
2 parents a1860ba + 50863a9 commit 8bb559c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions debian/postinst
Expand Up @@ -92,6 +92,12 @@ setup-dokku-installer() {
NGINX_ROOT="/etc/nginx"
[[ -x /usr/bin/openresty ]] && NGINX_ROOT="/usr/local/openresty/nginx/conf"

if command -v "python3" &>/dev/null; then
sed -i '1 s/^.*$/#!\/usr\/bin\/env python3/' /usr/share/dokku/contrib/dokku-installer.py
elif command -v "python2.7" &>/dev/null; then
sed -i '1 s/^.*$/#!\/usr\/bin\/env python2.7/' /usr/share/dokku/contrib/dokku-installer.py
fi

if [[ -f "$NGINX_ROOT/conf.d/dokku-installer.conf" ]]; then
echo "Setting up dokku-installer"
/usr/share/dokku/contrib/dokku-installer.py onboot
Expand Down
10 changes: 9 additions & 1 deletion plugins/scheduler-docker-local/scheduler-inspect
Expand Up @@ -48,7 +48,15 @@ EOF
for CONTAINER_FILE in $CONTAINER_FILES; do
CIDS+="$(<"$DOKKU_ROOT/$APP/$CONTAINER_FILE")"
done
"$DOCKER_BIN" container inspect "${CIDS[@]}" | python2.7 "$TMP_INSPECT_CMD"

local PYTHON_BIN=python
if command -v "python3" &>/dev/null; then
PYTHON_BIN=python3
elif command -v "python2.7" &>/dev/null; then
PYTHON_BIN=python2.7
fi

"$DOCKER_BIN" container inspect "${CIDS[@]}" | "$PYTHON_BIN" "$TMP_INSPECT_CMD"

}

Expand Down

0 comments on commit 8bb559c

Please sign in to comment.