#!/usr/bin/with-contenv bash

echo "**** Setting up poetry ****"

if [[ ! -f /lsiopy/bin/pip ]]; then
    python3 -m venv /lsiopy
fi

# Install poetry
curl -sSL https://install.python-poetry.org | python3 -

# Add poetry to the path
echo "**** ensuring poetry is in PATH ****"
if ! grep -q "/config/.local/bin" /var/run/s6/container_environment/PATH; then
    printf ':/config/.local/bin' >> /var/run/s6/container_environment/PATH
fi

echo "**** poetry setup complete ****"
