Source

udiskie / util / prepare_release

#!/bin/bash

# Build a release tarball from source.
# Usage:
#   util/prepare_release -r <revision>
# Resulting tarball will reside in dist/

REVISION=tip
while getopts "r:" OPTION; do
    case ${OPTION} in
        r) REVISION="${OPTARG}"
    esac
done

PYTHON=${PYTHON:-python}

[ -d dist ] || mkdir dist
TMPDEST=$(mktemp -d --tmpdir udiskie-release-XXXXXXXX)

hg archive -t files -r "${REVISION}" "${TMPDEST}"
hg log --style=changelog -r "${REVISION}:0" > "${TMPDEST}/CHANGES"

pushd "${TMPDEST}"
mv README.rst README
VERSION=$(${PYTHON} setup.py --version)
${PYTHON} setup.py sdist
popd

cp "${TMPDEST}/dist/udiskie-${VERSION}.tar.gz" dist/

rm -rf "${TMPDEST}"