From 8c85225333f3f8baf11280a2149e0bd87bf9d21e Mon Sep 17 00:00:00 2001 From: Jarrod Chesney Date: Thu, 5 Jan 2017 12:17:37 +1000 Subject: [PATCH] Added pipbuild --- pipbuild.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 pipbuild.sh diff --git a/pipbuild.sh b/pipbuild.sh new file mode 100755 index 0000000..e2e072a --- /dev/null +++ b/pipbuild.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +PACKAGE="wstools-py3" + +set -o nounset +set -o errexit +#set -x + +if [ -n "$(git status --porcelain)" ]; then + echo "There are uncomitted changes, please make sure all changes are comitted" >&2 + exit 1 +fi + +if ! [ -f "setup.py" ]; then + echo "setver.sh must be run in the directory where setup.py is" >&2 + exit 1 +fi + +VER="${1:?You must pass a version of the format 0.0.0 as the only argument}" + +if git tag | grep -q "${VER}"; then + echo "Git tag for version ${VER} already exists." >&2 + exit 1 +fi + +echo "Setting version to $VER" + +## Update the setup.py +#sed -i "s;^package_version.*=.*;package_version = '${VER}';" setup.py + +# Update the package version +sed -i "s;.*version.*;__version__ = '${VER}';" wstools/version.py + +# Upload to test pypi +if [[ ${VER} == *"dev"* ]]; then + python setup.py sdist + git reset --hard + +else + python setup.py sdist upload -r pypitest + # Reset the commit, we don't want versions in the commit + git commit -a -m "Updated to version ${VER}" + + git tag ${VER} + git push + git push --tags +fi + + + +echo "If you're happy with this you can now run :" +echo +echo "python setup.py sdist upload -r pypi" +echo \ No newline at end of file