diff options
| author | Sergey Shepelev <temotor@gmail.com> | 2015-04-05 03:21:31 +0300 |
|---|---|---|
| committer | Sergey Shepelev <temotor@gmail.com> | 2015-04-05 03:21:31 +0300 |
| commit | a332f2a8e6367e250fa4dd455fcd9f5375fe379f (patch) | |
| tree | 6a1d8d4f5985e1e1930fe6e20293901092e43163 /bin | |
| parent | ed3274df0793194fa03115a3fba19a492776e673 (diff) | |
| download | eventlet-a332f2a8e6367e250fa4dd455fcd9f5375fe379f.tar.gz | |
bin: scripts for developers
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/build-website.bash | 74 | ||||
| -rwxr-xr-x | bin/release | 50 |
2 files changed, 124 insertions, 0 deletions
diff --git a/bin/build-website.bash b/bin/build-website.bash new file mode 100755 index 0000000..a7229a6 --- /dev/null +++ b/bin/build-website.bash @@ -0,0 +1,74 @@ +#!/bin/bash +set -e + +build="$PWD/website-build" +usage="Builds eventlet.net website static pages into ${build}. +Requires sphinx-build, git and Github account. + + --no-commit Just build HTML, skip any git operations." + +commit=1 +while [ -n "$1" ]; do + case $1 in + --no-commit) + commit=0 + ;; + *) + echo "$usage" >&2 + exit 1 + ;; + esac + shift +done + +if ! which sphinx-build >/dev/null; then + echo "sphinx-build not found. Possible solution: pip install sphinx" >&2 + echo "Links: http://sphinx-doc.org/" >&2 + exit 1 +fi + +if [ $commit -eq 1 ] && ! git status >/dev/null; then + echo "git not found. git and Github account are required to update online documentation." >&2 + echo "Links: http://git-scm.com/ https://github.com/" >&2 + exit 1 +fi + +echo "1. clean" +rm -rf "$build" +mkdir -p "$build/doc" + +echo "2. build static pages" +cp doc/real_index.html "$build/index.html" +cp NEWS doc/changelog.rst + +# -b html -- builder, output mode +# -d dir -- path to doctrees cache +# -n -- nit-picky mode (kind of -Wall for gcc) +# -W -- turns warnings into errors +# -q -- quiet, emit only warnings and errors +sphinx-build -b html -d "$build/tmp" -n -q "doc" "$build/doc" +rm -rf "$build/tmp" +rm -f "$build/doc/.buildinfo" +rm -f "doc/changelog.rst" + +if [ $commit -eq 1 ]; then + echo "3. Updating git branch gh-pages" + source_name=`git rev-parse --abbrev-ref HEAD` + source_id=`git rev-parse --short HEAD` + git branch --track gh-pages origin/gh-pages || true + git checkout gh-pages + git ls-files -z |xargs -0 rm -f + rm -rf "doc" + + mv "$build"/* ./ + touch ".nojekyll" + echo "eventlet.net" >"CNAME" + rmdir "$build" + + echo "4. Commit" + git add -A + git status + + read -p "Carefully read git status output above, press Enter to continue or Ctrl+C to abort" + git commit --edit -m "Website built from $source_name $source_id" +fi diff --git a/bin/release b/bin/release new file mode 100755 index 0000000..539b0b2 --- /dev/null +++ b/bin/release @@ -0,0 +1,50 @@ +#!/bin/bash -e +cd "$( dirname "${BASH_SOURCE[0]}" )/.." +if [[ ! -d venv-release ]]; then + virtualenv venv-release + echo '*' >venv-release/.gitignore + venv-release/bin/pip install wheel sphinx +fi +. $PWD/venv-release/bin/activate +pip install -e $PWD + +main() { + branch="${1-$(git symbolic-ref --short HEAD)}" + version="$(python -c 'import eventlet; print(eventlet.__version__)')" + printf "branch: %s version: '%s'\n" $branch $version >&2 + if [[ "$branch" != "master" ]]; then + echo "Must be on master" >&2 + exit 1 + fi + if [[ -n "$(git status --short -uall)" ]]; then + echo "Tree must be clean" >&2 + exit 1 + fi + confirm "Continue? [yN] " || exit 1 + + if ! git tag "v$version"; then + echo "tag failed" >&2 + confirm "Continue still? [yN] " || exit 1 + fi + + if confirm "Upload to PyPi? [Yn] "; then + rm -rf build dist + python setup.py sdist bdist_wheel register upload + fi + + bin/build-website.bash + + git push origin master + git push --tags + git push origin gh-pages +} + +confirm() { + read -n1 -p "$1" reply + echo "" + rc=0 + [[ "$reply" != "y" ]] && rc=1 + return $rc +} + +main "$@" |
