Added scripts to release and upload docs

This commit is contained in:
Daniele Varrazzo 2014-08-31 02:44:21 +01:00
parent 9fdfa86200
commit 7faa06ce0b
3 changed files with 72 additions and 0 deletions

2
.gitignore vendored
View File

@ -9,5 +9,7 @@ build/*
doc/src/_build/* doc/src/_build/*
doc/html/* doc/html/*
doc/psycopg2.txt doc/psycopg2.txt
scripts/pypi_docs_upload.py
env env
.tox .tox
/rel

15
scripts/upload-docs.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DOCDIR="$DIR/../doc"
# this command requires ssh configured to the proper target
tar czf - -C "$DOCDIR/html" . | ssh psycoweb tar xzvf - -C docs/current
# download the script to upload the docs to PyPI
test -e "$DIR/pypi_docs_upload.py" \
|| wget -O "$DIR/pypi_docs_upload.py" \
https://gist.githubusercontent.com/dvarrazzo/dac46237070d69dbc075/raw
# this command requires a ~/.pypirc with the right privileges
python "$DIR/pypi_docs_upload.py" psycopg2 "$DOCDIR/html"

55
scripts/upload-release.sh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
# Script to create a psycopg release
#
# You must create a release tag before running the script, e.g. 2_5_4.
# The script will check out in a clear environment, build the sdist package,
# unpack and test it, then upload on PyPI and on the psycopg website.
set -e
REPO_URL=git@github.com:psycopg/psycopg2.git
VER=$(grep ^PSYCOPG_VERSION setup.py | cut -d "'" -f 2)
# avoid releasing a testing version
echo "$VER" | grep -qE '^[0-9]+\.[0-9]+(\.[0-9]+)?$' \
|| (echo "bad release: $VER" >&2 && exit 1)
# Check out in a clean environment
rm -rf rel
mkdir rel
cd rel
git clone $REPO_URL psycopg
cd psycopg
TAG=${VER//./_}
git checkout -b $TAG $TAG
make env # to build the docs
make sdist
# Test the sdist just created
cd dist
tar xzvf psycopg2-$VER.tar.gz
cd psycopg2-$VER
make
make check
cd ../../
read -p "if you are not fine with the above stop me now..."
# upload to pypi and to the website
python setup.py sdist --formats=gztar upload -s
DASHVER=${VER//./-}
DASHVER=${DASHVER:0:3}
# Requires ssh configuration for 'psycoweb'
scp dist/psycopg2-${VER}.tar.gz psycoweb:tarballs/PSYCOPG-${DASHVER}/
ssh psycoweb ln -sfv PSYCOPG-${DASHVER}/psycopg2-${VER}.tar.gz \
tarballs/psycopg2-latest.tar.gz
scp dist/psycopg2-${VER}.tar.gz.asc psycoweb:tarballs/PSYCOPG-${DASHVER}/
ssh psycoweb ln -sfv PSYCOPG-${DASHVER}/psycopg2-${VER}.tar.gz.asc \
tarballs/psycopg2-latest.tar.gz.asc
echo "great, now write release notes and an email!"