#!/bin/bash set -o nounset -o errexit -o pipefail SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # To generate a Python version, we will need to mangle it # slightly. Namely, we must perform the following translations: # # 1) Skip the leading "v" (i.e., "1.3.11", not "v1.3.11"). # 2) Change "-dev-" into an alpha release "a". # 3) Change "-rc-" into a release candidate "rc". # 4) Change "-" into a local version label; # e.g. "+37bc2f9-dirty" rather than "-37bc2f9-dirty". # # This ensures conformance with PEP440: # https://www.python.org/dev/peps/pep-0440/#version-scheme. echo $($SCRIPT_ROOT/get-version "$@") | \ sed 's/v//' | \ sed 's/-dev-/a/' | \ sed 's/-rc-/rc/' | \ sed 's/-/+/'