summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/get-version.sh7
-rwxr-xr-xtools/update-version.sh7
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/get-version.sh b/tools/get-version.sh
new file mode 100755
index 0000000..67033f8
--- /dev/null
+++ b/tools/get-version.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+{
+ python3 -c "import setuptools_scm" || python3 -m pip install --user setuptools-scm
+} 1>&2 # redirect stdout to stderr to avoid polluting the output
+python3 -m setuptools_scm | \
+ sed 's/Guessed Version\([^+]\+\).*/\1/'
diff --git a/tools/update-version.sh b/tools/update-version.sh
new file mode 100755
index 0000000..a227023
--- /dev/null
+++ b/tools/update-version.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+DIR=$(dirname "$0")
+VERSION=$(./tools/get-version.sh)
+mkdir -p "${DIR}/../dist"
+sed -e "s/VERSION_PLACEHOLDER/${VERSION}/" \
+ "${DIR}/../dist/python-ansible-compat.spec.in" \
+ > "${DIR}/../dist/python-ansible-compat.spec"