build.sh: fix python package version

This commit is contained in:
Benjamin Renard 2023-07-10 13:06:01 +02:00
parent e38e5b10a7
commit 71a49f7b2f
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -18,8 +18,18 @@ fi
echo "Detect version using git describe..." echo "Detect version using git describe..."
VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )" VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )"
echo "Set version=$VERSION in setup.py using sed..." echo "Computing python version..."
sed -i "s/^version *=.*$/version = '$VERSION'/" setup.py if [ $( echo "$VERSION"|grep -c "-" ) -gt 0 ]
then
echo "Development version detected ($VERSION), compute custom python dev version"
PY_VERSION="$( echo "$VERSION"|sed 's/-\([0-9]\)\+-.*$/.dev\1/' )"
else
echo "Clean tagged version detected, use it"
PY_VERSION="$VERSION"
fi
echo "Set version=$PY_VERSION in setup.py using sed..."
sed -i "s/^version *=.*$/version = '$PY_VERSION'/" setup.py
if [ -d venv ] if [ -d venv ]
then then