try with patch version if not

cf https://discuss.afpy.org/t/venv-direnv-prompt-bash-et-emacs-et-lsp/1845/4
This commit is contained in:
Zach D. LAMAZIERE 2023-12-10 19:13:58 +01:00
parent 94aca0f27a
commit aa6cb4359c
1 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,10 @@
#!/bin/bash
_get_last_patch()
{
curl -s https://www.python.org/ftp/python/ | grep -o ">[0-9.]\+/<" | sed "s/^>//;s|/<$||"| grep ^$1 | sort --version-sort | tail -n 1
}
compile-python()
{
# Inspired from the great https://gitlab.com/python-devs/ci-images/
@ -14,7 +19,8 @@ compile-python()
(
cd /tmp || return 1
wget -qO- "$URL/$PY_VERSION/Python-$PY_VERSION$BETA.tgz" | tar -xzf - || (
echo "Version not found, check on $URL."
echo "Version '$PY_VERSION' not found, check on $URL."
echo "Ttrying something else." && compile-python `_get_last_patch $PY_VERSION`
)
[ -d "Python-$PY_VERSION$BETA" ] && (cd "Python-$PY_VERSION$BETA"; ./configure --prefix="$HOME/.local/" && make -j "$(nproc)" && make altinstall) &&
rm -r "Python-$PY_VERSION$BETA"