From 71a49f7b2f6173fb2dd6a3c60d779def7999c294 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 10 Jul 2023 13:06:01 +0200 Subject: [PATCH] build.sh: fix python package version --- build.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 6fe36a5..c910396 100755 --- a/build.sh +++ b/build.sh @@ -18,8 +18,18 @@ fi echo "Detect version using git describe..." VERSION="$( git describe --tags|sed 's/^[^0-9]*//' )" -echo "Set version=$VERSION in setup.py using sed..." -sed -i "s/^version *=.*$/version = '$VERSION'/" setup.py +echo "Computing python version..." +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 ] then