roam/.envrc

23 lines
703 B
Text
Raw Normal View History

2024-08-23 05:32:48 +00:00
if test -e env/bin/activate
then
. ./env/bin/activate
fi
if test -f pyproject.toml; then
backend=$(sed -nr 's/^build-backend *= *\"([a-z]+).*/\1/p' pyproject.toml)
case $backend in
poetry|pdm|hatchling)
backend_command=${backend%ling}
if ! command -v $backend_command >/dev/null 2>&1; then
echo WARNING: $backend_command is not installed, the Python environment will not be loaded >/dev/stderr
else
while IFS= read -r -d $'\0' pair; do
export "$pair"
done < <($backend_command run env -0)
fi
;;
,*)
echo "WARNING: Unsupported build backend '$backend', the Python environment will not be loaded" >/dev/stderr
esac
fi