瀏覽代碼

Created a release script; added a MANIFEST.in file.

tags/v0.4
Ben Kurtovic 10 年之前
父節點
當前提交
5d08e9e316
共有 5 個檔案被更改,包括 161 行新增1 行删除
  1. +1
    -0
      CHANGELOG
  2. +2
    -0
      MANIFEST.in
  3. +1
    -0
      docs/changelog.rst
  4. +155
    -0
      scripts/release.sh
  5. +2
    -1
      setup.py

+ 1
- 0
CHANGELOG 查看文件

@@ -1,6 +1,7 @@
v0.4 (unreleased):

- Added a script to test for memory leaks in scripts/memtest.py.
- Added a script to do releases in scripts/release.sh.

v0.3.3 (released April 22, 2014):



+ 2
- 0
MANIFEST.in 查看文件

@@ -0,0 +1,2 @@
include LICENSE CHANGELOG
recursive-include tests *.py *.mwtest

+ 1
- 0
docs/changelog.rst 查看文件

@@ -8,6 +8,7 @@ Unreleased
(`changes <https://github.com/earwig/mwparserfromhell/compare/v0.3.3...develop>`__):

- Added a script to test for memory leaks in :file:`scripts/memtest.py`.
- Added a script to do releases in :file:`scripts/release.sh`.

v0.3.3
------


+ 155
- 0
scripts/release.sh 查看文件

@@ -0,0 +1,155 @@
#! /usr/bin/env bash

if [[ -z "$1" ]]; then
echo "usage: $0 1.2.3"
exit 1
fi

VERSION=$1
SCRIPT_DIR=$(dirname "$0")
RELEASE_DATE=$(date +"%B %d, %Y")

check_git() {
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
echo "Aborting: dirty working directory."
exit 1
fi
if [[ "$(git rev-parse --abbrev-ref HEAD)" != "develop" ]]; then
echo "Aborting: not on develop."
exit 1
fi
echo -n "Are you absolutely ready to release? [yN] "
read confirm
if [[ ${confirm,,} != "y" ]]; then
exit 1
fi
}

update_version() {
echo -n "Updating mwparserfromhell.__version__..."
sed -e 's/__version__ = .*/__version__ = "'$VERSION'"/' -i "" mwparserfromhell/__init__.py
echo " done."
}

update_changelog() {
filename="CHANGELOG"
echo -n "Updating $filename..."
sed -e '1s/.*/v'$VERSION' (released '$RELEASE_DATE'):/' -i "" $filename
echo " done."
}

update_docs_changelog() {
filename="docs/changelog.rst"
echo -n "Updating $filename..."
dashes=$(seq 1 $(expr ${#VERSION} + 1) | sed 's/.*/-/' | tr -d '\n')
previous_lineno=$(expr $(grep -n -e "^---" $filename | sed '2q;d' | cut -d ':' -f 1) - 1)
previous_version=$(sed $previous_lineno'q;d' $filename)
sed \
-e '4s/.*/v'$VERSION \
-e '5s/.*/'$dashes \
-e '7s/.*/`Released '$RELEASE_DATE' <https:\/\/github.com\/earwig\/mwparserfromhell\/tree\/v'$VERSION'>`_/' \
-e '8s/.*/(`changes <https:\/\/github.com\/earwig\/mwparserfromhell\/compare\/v'$previous_version'...v'$VERSION'>`__):/' \
-i "" $filename
echo " done."
}

do_git_stuff() {
echo -n "Git: committing, tagging, and merging release..."
git commit -qam "release/$VERSION"
git tag v$VERSION -s -m "version $VERSION"
git checkout -q master
git merge -q --no-ff develop -m "Merge branch 'develop'"
echo -n " pushing..."
git push -q --tags origin master
git checkout -q develop
git push -q origin develop
echo " done."
}

build_sdist() {
echo -n "Uploading to PyPI..."
python setup.py register sdist upload -s
python setup.py upload_docs
echo " done."
}

post_release() {
echo
echo "*** Release completed."
echo "*** Update: https://github.com/earwig/mwparserfromhell/releases/tag/v$VERSION"
echo "*** Verify: https://pypi.python.org/pypi/mwparserfromhell"
echo "*** Verify: https://mwparserfromhell.readthedocs.org"
echo "*** Press enter to sanity-check the release."
read
}

test_release() {
echo
echo "Checking mwparserfromhell v$VERSION..."
echo -n "Creating a virtualenv..."
virtdir="mwparser-test-env"
virtualenv -q $virtdir
cd $virtdir
source bin/activate
echo " done."
echo -n "Installing mwparserfromhell with pip..."
pip -q install mwparserfromhell
echo " done."
echo -n "Checking version..."
reported_version=$(python -c 'print __import__("mwparserfromhell").__version__')
if [[ "$reported_version" != "$VERSION" ]]; then
echo " error."
echo "*** ERROR: mwparserfromhell is reporting its version as $reported_version, not $VERSION!"
deactivate
cd ..
rm -rf $virtdir
exit 1
else
echo " done."
fi
pip -q uninstall -y mwparserfromhell
echo -n "Downloading mwparserfromhell source tarball and GPG signature..."
curl -sL "https://pypi.python.org/packages/source/m/mwparserfromhell/mwparserfromhell-$VERSION.tar.gz" -o "mwparserfromhell.tar.gz"
curl -sL "https://pypi.python.org/packages/source/m/mwparserfromhell/mwparserfromhell-$VERSION.tar.gz.asc" -o "mwparserfromhell.tar.gz.asc"
echo " done."
echo "Verifying tarball..."
gpg --verify mwparserfromhell.tar.gz.asc
if [[ "$?" != "0" ]]; then
echo "*** ERROR: GPG signature verification failed!"
deactivate
cd ..
rm -rf $virtdir
exit 1
fi
tar -xf mwparserfromhell.tar.gz
rm mwparserfromhell.tar.gz mwparserfromhell.tar.gz.asc
cd mwparserfromhell-$VERSION
echo "Running unit tests..."
python setup.py -q test
if [[ "$?" != "0" ]]; then
echo "*** ERROR: Unit tests failed!"
deactivate
cd ../..
rm -rf $virtdir
exit 1
fi
echo -n "Everything looks good. Cleaning up..."
deactivate
cd ../..
rm -rf $virtdir
echo " done."
}

echo "Preparing mwparserfromhell v$VERSION..."
cd "$SCRIPT_DIR/.."

check_git
update_version
update_changelog
update_docs_changelog
do_git_stuff
post_release
test_release

echo "All done."
exit 0

+ 2
- 1
setup.py 查看文件

@@ -36,7 +36,8 @@ with open("README.rst") as fp:
long_docs = fp.read()

tokenizer = Extension("mwparserfromhell.parser._tokenizer",
sources = ["mwparserfromhell/parser/tokenizer.c"])
sources = ["mwparserfromhell/parser/tokenizer.c"],
depends = ["mwparserfromhell/parser/tokenizer.h"])

setup(
name = "mwparserfromhell",


Loading…
取消
儲存