#! /bin/sh
# Mk-distr script
#
# This program is a part of Uptime package.
#

# __author__ = "Oleg Broytman <phd@phdru.name>"
# __copyright__ = "Copyright (C) 2003-2013 PhiloSoft Design"
# __license__ = "GNU GPL"

umask 022

if [ -n "$1" ]; then
   git checkout "$1"
fi &&

git archive --format=tar --prefix=uptime/ HEAD |
   (cd "$HOME/tmp" && exec tar xf -) &&
cd "$HOME/tmp/uptime" &&

sed 's/^password.\+$/password = ***/' uptime.conf >_tmp &&
mv _tmp uptime.conf  && \
python setup.py sdist &&

cd dist && mv uptime-*.tar.gz ../.. && cd ../.. && exec rm -rf uptime
