diff --git a/.gitignore b/.gitignore index 545fd19..67e510f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ build/ dist/ +*.egg-info/ __pycache__ +pypi.*key diff --git a/tools/dist.sh b/tools/dist.sh new file mode 100755 index 0000000..390be74 --- /dev/null +++ b/tools/dist.sh @@ -0,0 +1,18 @@ +#!/bin/bash +if [[ ! -d .git ]]; then + echo "$0 must be run from the project root" + exit 1 +fi +rm -rf dist build soundcraft_utils.egg-info +if [[ $VERSION_SUFFIX ]]; then + echo "Overriding version with $VERSION_SUFFIX" + ORIG=soundcraft/__init__.py + BAK=${ORIG}.bak + if [[ -f $BAK ]]; then + echo "$BAK already exists" + exit 1 + fi + sed -i.bak -e "s/^\\(__version__ = ['\"][^'\"]*\\)/\\1$VERSION_SUFFIX/" $ORIG +fi +python3 setup.py sdist bdist_wheel +[[ -f $BAK ]] && mv $BAK $ORIG diff --git a/tools/release.sh b/tools/release.sh new file mode 100755 index 0000000..ee9bbad --- /dev/null +++ b/tools/release.sh @@ -0,0 +1,11 @@ +#!/bin/bash +TOOLS=$(dirname $0) +grep version soundcraft/__init__.py +echo -n "About to release; are you sure? [y/N] " +read answer +if [[ ! $answer =~ ^[yY] ]]; then + echo "Exiting" + exit 1 +fi +$TOOLS/dist.sh || exit 1 +python3 -m twine upload --user __token__ --password $(<$TOOLS/pypi.realkey) dist/* diff --git a/tools/testupload.sh b/tools/testupload.sh new file mode 100755 index 0000000..1a24ea4 --- /dev/null +++ b/tools/testupload.sh @@ -0,0 +1,16 @@ +#!/bin/bash +TOOLS=$(dirname $0) +export VERSION_SUFFIX=$1 +if [[ ! $VERSION_SUFFIX ]]; then + echo "usage: $0 [a1|b1|rc1]" + exit 1 +fi +if [[ ! $VERSION_SUFFIX =~ ^(a|b|rc)[0-9]+$ ]]; then + echo "Suffix must be one of:" + echo " a2" + echo " b5" + echo " rc1" + exit 2 +fi +$TOOLS/dist.sh || exit 1 +python3 -m twine upload --user __token__ --password $(<$TOOLS/pypi.testkey) --repository-url https://test.pypi.org/legacy/ dist/*