[CI/CD] grep the version out of version.py.
All checks were successful
continuous-integration/drone/push Build is passing

Instead of running `python setup.py --version`.

That's because earlier versions of Python that don't fully support
dynamic version specifications through `pyproject.toml` may just return
`0.0.0` here.
This commit is contained in:
Fabio Manganiello 2024-07-27 15:26:58 +02:00
parent 54c2264403
commit 4568b4659e
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 2 additions and 2 deletions

View file

@ -16,7 +16,7 @@ apt install -y curl dpkg-dev gpg git python3 python3-pip python3-setuptools
echo "--- Parsing metadata"
git config --global --add safe.directory "$PWD"
git pull --rebase origin master --tags
export VERSION=$(python3 setup.py --version)
export VERSION=$(grep -e '^__version__' "${SRCDIR}/version.py" | sed -r -e 's/^__version__\s*=\s*"([^"]+)"$/\1/')
export GIT_VERSION="$VERSION-$(git log --pretty=oneline HEAD...v$VERSION | wc -l)"
export GIT_BUILD_DIR="$WORKDIR/${PKG_NAME}_${GIT_VERSION}_all"
export GIT_DEB="$WORKDIR/${PKG_NAME}_${GIT_VERSION}_all.deb"

View file

@ -26,7 +26,7 @@ mkdir -p "$RPM_ROOT"
echo "--- Parsing metadata"
git config --global --add safe.directory $PWD
git pull --rebase origin master --tags
export VERSION=$(python3 setup.py --version)
export VERSION=$(grep -e '^__version__' "${SRCDIR}/version.py" | sed -r -e 's/^__version__\s*=\s*"([^"]+)"$/\1/')
export RELNUM="$(git log --pretty=oneline HEAD...v$VERSION | wc -l)"
export SPECFILE="$WORKDIR/$PKG_NAME.spec"
export BUILD_DIR="$WORKDIR/build"