2 cd "$( dirname "${BASH_SOURCE[0]}" )/.."
3 if [[ ! -d venv-release ]]; then
4 virtualenv venv-release
5 echo '*' >venv-release/.gitignore
6 venv-release/bin/pip install -U pip setuptools sphinx wheel
8 . $PWD/venv-release/bin/activate
15 branch="${1-$(git symbolic-ref --short HEAD)}"
16 version="$(python -c 'import eventlet; print(eventlet.__version__)')"
17 printf "\nbranch: %s eventlet.__version__: '%s'\n" $branch $version >&2
18 if [[ "$branch" != "master" ]]; then
19 echo "Must be on master" >&2
22 if [[ -n "$(git status --short -uall)" ]]; then
23 echo "Tree must be clean. git status:" >&2
25 git status --short -uall
29 last_commit_message=$(git show --format="%s" --no-patch HEAD)
30 expect_commit_message="v$version release"
31 if [[ "$last_commit_message" != "$expect_commit_message" ]]; then
32 printf "Last commit message: '%s' expected: '%s'\n" "$last_commit_message" "$expect_commit_message" >&2
33 if confirm "Create release commit? [yN] "; then
35 elif ! confirm "Continue without proper release commit? [yN] "; then
39 confirm "Continue? [yN] " || exit 1
41 echo "Creating tag v$version" >&2
42 if ! git tag "v$version"; then
43 echo "git tag failed " >&2
44 confirm "Continue still? [yN] " || exit 1
47 if confirm "Build documentation (website)? [Yn] " >&2; then
48 bin/build-website.bash || exit 1
51 if confirm "Upload to PyPi? [Yn] "; then
53 python setup.py sdist bdist_wheel register upload || exit 1
56 git push --verbose origin master gh-pages || exit 1
63 echo "1. bump version" >&2
64 echo "2. update NEWS, AUTHORS" >&2
66 echo "4. run bin/release again" >&2
73 confirm "Ready to commit? [Yn] " || exit 1
74 git commit -a -m "v$version_next release"
76 echo "Re-exec $0 to continue" >&2
81 local current=$version
82 echo "Current version: '$current'" >&2
83 echo -n "Enter next version (empty to abort): " >&2
85 if [[ -z "$version_next" ]]; then
88 echo "Next version: '$version_next'" >&2
90 local current_tuple="${current//./, }"
91 local next_tuple="${version_next//./, }"
92 local version_path="eventlet/__init__.py"
93 echo "Updating file '$version_path'" >&2
94 if ! sed -i '' -e "s/($current_tuple)/($next_tuple)/" "$version_path"; then
95 echo "sed error $?" >&2
98 if git diff --exit-code "$version_path"; then
99 echo "File '$version_path' is not modified" >&2
104 local doc_path="doc/real_index.html"
105 echo "Updating file '$doc_path'" >&2
106 if ! sed -i '' -e "s/$current/$version_next/g" "$doc_path"; then
107 echo "sed error $?" >&2
110 if git diff --exit-code "$doc_path"; then
111 echo "File '$doc_path' is not modified" >&2
116 confirm "Confirm changes? [yN] " || exit 1
120 echo "Changes since last release:" >&2
121 git log --format='%h %an %s' "v$version"^.. -- || exit 1
124 local editor=$(which edit 2>/dev/null)
125 [[ -z "$editor" ]] && editor="$EDITOR"
126 if [[ -n "$editor" ]]; then
127 if confirm "Open default editor for NEWS and AUTHORS? [Yn] "; then
131 confirm "Change files NEWS and AUTHORS manually and press any key"
134 echo "Unable to determine default text editor." >&2
135 confirm "Change files NEWS and AUTHORS manually and press any key"
139 if git diff --exit-code NEWS AUTHORS; then
140 echo "Files NEWS and AUTHORS are not modified" >&2
145 confirm "Confirm changes? [yN] " || exit 1
151 read -n1 -p "$prompt" reply >&2
154 local default_y=" \[Yn\] $"
155 if [[ -z "$reply" ]] && [[ "$prompt" =~ $default_y ]]; then
158 [[ "$reply" != "y" ]] && rc=1