Skip to content

Commit

Permalink
Fix getting python release version
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Mar 22, 2024
1 parent ae9a29c commit dc2b00a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,23 @@ EOF
rm "$log" # remove symlink
}

function get_python_release_version {
local version
local offset="0"

# version from setup.py
version="$(python3 setup.py --version)"

if git rev-parse --is-inside-work-tree &> /dev/null; then
# commit offset from latest version update in setup.py
sha=$(git log -n 1 --pretty=format:'%H' -G"version *=" setup.py)

offset="$(git rev-list --count "$sha..HEAD")"
fi

echo "$version-$offset$DEB_DISTRO"
}

function build_python_pkg {
local old_path=$PWD
local pkg_name=$1
Expand All @@ -226,8 +243,7 @@ function build_python_pkg {
test -f "./COLCON_IGNORE" && echo "Skipped (COLCON_IGNORE)" && return

# Get + Check release version
# <release version>-1
version="$(python3 setup.py --version)-1" || return 5
version="$(get_python_release_version)" || return 5
local deb_pkg_name; deb_pkg_name="python3-$(python3 setup.py --name)"
pkg_exists "$deb_pkg_name" "$version" && return

Expand Down

0 comments on commit dc2b00a

Please sign in to comment.