diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/get-version.sh | 9 | ||||
-rwxr-xr-x | tools/update-spec.sh | 15 | ||||
-rwxr-xr-x | tools/update-version.sh | 7 |
3 files changed, 23 insertions, 8 deletions
diff --git a/tools/get-version.sh b/tools/get-version.sh index 67033f8..a8b9a53 100755 --- a/tools/get-version.sh +++ b/tools/get-version.sh @@ -1,7 +1,14 @@ #!/bin/bash set -e { - python3 -c "import setuptools_scm" || python3 -m pip install --user setuptools-scm + python3 -c "import setuptools_scm" >/dev/null || { + if [[ "$VIRTUAL_ENV" != "" ]]; then + PIPARGS="" + else + PIPARGS="--user" + fi + python3 -m pip install $PIPARGS 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-spec.sh b/tools/update-spec.sh new file mode 100755 index 0000000..2e8ceee --- /dev/null +++ b/tools/update-spec.sh @@ -0,0 +1,15 @@ +#!/bin/bash +DIR=$(dirname "$0") +VERSION=$(./tools/get-version.sh) +mkdir -p "${DIR}/../dist" +sed -e "s/VERSION_PLACEHOLDER/${VERSION}/" \ + "${DIR}/../.config/python3-ansible-compat.spec" \ + > "${DIR}/../dist/python3-ansible-compat.spec" + +export LC_ALL=en_US.UTF-8 +CHANGELOG=$(git log -n 20 --pretty="* %ad %an %ae \n- %s\n" --date=format:"%a %b %d %Y") +NUM=$(grep -nr "%changelog" ${DIR}/../dist/python3-ansible-compat.spec|awk -F':' '{print $1}') +let NUM_START=$NUM+1 +NUM_END=$(awk '{print NR}' ${DIR}/../dist/pytho3n-ansible-compat.spec|tail -n1) +sed -i "${NUM_START},${NUM_END}d" ${DIR}/../dist/python3-ansible-compat.spec +echo -e "$CHANGELOG" >> ${DIR}/../dist/python3-ansible-compat.spec diff --git a/tools/update-version.sh b/tools/update-version.sh deleted file mode 100755 index a227023..0000000 --- a/tools/update-version.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/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" |