try with patch version if not #1

Closed
z4c wants to merge 3 commits from z4c/compile-python:main into main

View File

@ -1,5 +1,31 @@
#!/bin/bash #!/bin/bash
Outdated
Review

I'm a bit sad it does not work with alpha releases.

compile-python 3.13 may try compile-python 3.13.0 but it does not exists, only the alphas exists.

Oh does it make this implem run in an infinite loop? :D

I'm a bit sad it does not work with alpha releases. `compile-python 3.13` may try `compile-python 3.13.0` but it does not exists, only the alphas exists. Oh does it make this implem run in an infinite loop? :D
_get_last_tag()
{
[[ $1 =~ ^[23.]\.[0-9]+\.[0-9]+$ ]] && echo $1 || \
curl -s https://www.python.org/ftp/python/ \
| grep -o ">[0-9.]\+/<" \
| sed "s/^>//;s|/<$||" \
| grep ^$1 \
| sort --version-sort \
| tail -n 1
}
_get_last_instable()
{
[[ $1 =~ ^[23.]\.[0-9]+\.0$ ]] && \
curl -s https://www.python.org/ftp/python/$1/ \
| grep -o "Python-[0-9]\.[0-9]\+\.0[a-z0-9]\+" \
| sort \
| uniq \
| sed "s/Python-[0-9.]*//;" \
Outdated
Review

Is this line to "autocorrect" from 3.12 to 3.12.0? (Or from 3.11 to 3.11.7?
(Beware of the double t)

Is this line to "autocorrect" from `3.12` to `3.12.0`? (Or from `3.11` to `3.11.7`? (Beware of the double t)
Outdated
Review

yep. that's it.

_get_last_patch 3.12
=> 3.12.1
yep. that's it. ``` _get_last_patch 3.12 => 3.12.1 ```
| sort --version-sort \
| tail -n 1
}
compile-python() compile-python()
{ {
# Inspired from the great https://gitlab.com/python-devs/ci-images/ # Inspired from the great https://gitlab.com/python-devs/ci-images/
@ -8,16 +34,18 @@ compile-python()
# Needs: # Needs:
# sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev # sudo apt-get update; sudo apt-get install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
local PY_VERSION="$1" local PY_VERSION=`_get_last_tag $1`
local BETA="$2" local BETA=${2:-`_get_last_instable $PY_VERSION`}
local URL="https://www.python.org/ftp/python" local URL="https://www.python.org/ftp/python"
( (
cd /tmp || return 1 cd /tmp || return 1
[ -f $HOME/.local/bin/python${PY_VERSION}${BETA} ] || return 2
wget -qO- "$URL/$PY_VERSION/Python-$PY_VERSION$BETA.tgz" | tar -xzf - || ( wget -qO- "$URL/$PY_VERSION/Python-$PY_VERSION$BETA.tgz" | tar -xzf - || (
echo "Version not found, check on $URL." echo "Version not found, check on $URL."
) )
[ -d "Python-$PY_VERSION$BETA" ] && (cd "Python-$PY_VERSION$BETA"; ./configure --prefix="$HOME/.local/" && make -j "$(nproc)" && make altinstall) && [ -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" rm -r "Python-$PY_VERSION$BETA" &&
cp $HOME/.local/bin/python${PY_VERSION%.*} $HOME/.local/bin/python${PY_VERSION}${BETA}
) )
} }