23 lines
703 B
Text
23 lines
703 B
Text
|
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
|