Skip to content

Commit

Permalink
Update PyPT and set master as default branch
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 21, 2016
1 parent a03c371 commit 04637bd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 235 deletions.
193 changes: 0 additions & 193 deletions .pypt/README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion .pypt/commitlog
Expand Up @@ -80,7 +80,7 @@ def main():
parser.add_argument('basedir', metavar='BASEDIR', nargs=1,
help='Project directory')
parser.add_argument('new_version', metavar='NEWVERSION', nargs=1,
help='New version (vX.Y.Z)')
help='New version (X.Y.Z)')
args = parser.parse_args()
# nargs gets you lists, not strings
filename = args.filename[0]
Expand Down
2 changes: 1 addition & 1 deletion PKGBUILD-git
Expand Up @@ -13,7 +13,7 @@ makedepends=('git')
options=(!emptydirs)
provides=('pkgbuilder')
conflicts=('pkgbuilder')
source=("git+https://github.com/Kwpolska/${_gitname}#branch=develop")
source=("git+https://github.com/Kwpolska/${_gitname}")
md5sums=('SKIP')

package() {
Expand Down
65 changes: 25 additions & 40 deletions release
@@ -1,7 +1,7 @@
#!/bin/zsh
# The Release Script
# Part of the Python Project Template.
# Copyright © 2013-2016, Chris Warrick.
# Copyright © 2013-2016, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -46,31 +46,19 @@ function error {
}

function cleanup {
rm -rf $PROJECTLC.egg-info build
rm -rf **/__pycache__
rm -rf $PROJECTLC.egg-info build || true
rm -rf **/__pycache__ || true
}

function cleanup_cmfn {
[[ -e $cmfn ]] && rm $cmfn
[[ -e $cmfn2 ]] && rm $cmfn2
[[ -e $cmfn ]] && rm $cmfn || true
[[ -e $cmfn2 ]] && rm $cmfn2 || true
}

status '*** Kw’s Release Scripts'
status '*** Chris Warrick’s Release Scripts (PyPT)'

branch=$(git rev-parse --abbrev-ref HEAD)
if [[ $? != 0 ]]; then
error 'Cannot fetch the current branch.'
exit 2
fi

echo $branch | grep '^release/' > /dev/null
if [[ $? != 0 ]]; then
error 'Not on a git-flow release branch.'
status 'Run: git flow release start [version number here]'
exit 2
fi

version=$(echo $branch | sed 's|^release/||')
echo -n "Version number: "
read version

echo $version | grep '^[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}$' > /dev/null

Expand All @@ -97,7 +85,7 @@ if [[ $? != 0 ]]; then
fi
fi

# I am creating all the dates at the exact same time.
# Creating all the dates at the exact same time.
date=$(date '+%Y-%m-%d')
datel=$(date '+%Y-%m-%d %H:%M%z')
#datep=$(date '+%Y%m%d')
Expand All @@ -111,7 +99,7 @@ cleanup_cmfn
git add -A --ignore-errors .

cat > $cmfn <<EOF
#~ Kw’s Release Scripts
#~ Chris Warrick’s Release Scripts (PyPT)
#~ Please write your commit and changelog messages.
#~ You may use reST formatting in the latter.
#~ Please make the first line of your commit message short.
Expand Down Expand Up @@ -140,7 +128,6 @@ else
fi

.pypt/commitlog $cmfn $PWD $version
[[ $? != 0 ]] && exit $?

status 'Replacing versions and dates in files...'
sed "s/version=.*/version='$version',/g" setup.py -i
Expand All @@ -151,10 +138,8 @@ sed "s/# $PROJECT v.*/# $PROJECT v$version/" $PROJECTLC/**/*.py -i
sed "s/__version__ = .*/__version__ = '$version'/g" $PROJECTLC/__init__.py -i
sed "s/:Date: .*/:Date: $date/g" docs/*.rst -i

[[ -e PKGBUILD ]] && sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD -i
[[ -e PKGBUILD-git ]] && sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD-git -i
[[ -e PKGBUILD-2 ]] && sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD-2 -i
[[ -e PKGBUILD-2-git ]] && sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD-2-git -i
sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD -i || true
sed "s/pkgver=.*/pkgver=$version/g" PKGBUILD-git -i || true

cp docs/README.rst docs/CHANGELOG.rst docs/CONTRIBUTING.rst .
cp docs/README.rst README
Expand All @@ -164,15 +149,15 @@ status 'Generating locales...'

status 'Importing...'
python -c "import $PROJECTLC"
if [[ $? = 1 ]]; then
if [[ $? == 1 ]]; then
error "Import failed. Fix your code or don't come back."
exit 1
fi

if [[ -e tests ]]; then
status 'Running tests...'
py.test tests/
if [[ $? = 1 ]]; then
if [[ $? == 1 ]]; then
error "Tests failed. Fix your code or don't come back."
exit 1
fi
Expand All @@ -185,22 +170,22 @@ status 'Running pre-sdist.hook...'
status 'This is the last chance to quit. Hit ^C now if you want to.'
read bailout

./setup.py sdist bdist_wheel
twine upload -s dist/$PROJECTLC-$version.tar.gz dist/$PROJECTLC-$version*.whl
./setup.py sdist bdist_wheel || exit $?
twine upload -s dist/$PROJECTLC-$version.tar.gz dist/$PROJECTLC-$version*.whl || exit $?

[[ -e PKGBUILD ]] && status 'Updating AUR PKGBUILDs...'
[[ -e PKGBUILD ]] && md5out=$(md5sum 'dist/'$PROJECTLC'-'$version'.tar.gz'|awk '{print $1}')
[[ -e PKGBUILD ]] && sed "s/md5sums=.*/md5sums=('$md5out')/" PKGBUILD -i
if [[ -e PKGBUILD ]]; then
status 'Updating AUR PKGBUILDs...'
md5out=$(md5sum 'dist/'$PROJECTLC'-'$version'.tar.gz'|awk '{print $1}')
sed "s/md5sums=.*/md5sums=('$md5out')/" PKGBUILD -i
fi

cleanup

git add -A --ignore-errors .

git commit -S -asF $cmfn2
git add -A --ignore-errors . || exit $?

git flow release finish -s -m "Version $version" $version
git push
git push --tags
git commit -S -asF $cmfn2 || exit $?
git tag -sm "Version $version" v$version || exit $?
git push --follow-tags origin master || exit $?

.pypt/ghrel $cmfn $PWD $GITUSER/$GITREPO v$version

Expand Down

0 comments on commit 04637bd

Please sign in to comment.