#!/bin/sh

DATE=`date -R`
VER=`sed -n -e "s/^[ \t]*version *= *'\\(.*\\)', *$/\1/p" setup.py`

if [ x$1 = xbzr -o x$1 = x--bzr ]; then
  VER="${VER}~bzr"`date +%Y%m%d`
fi

for i in copyright.in changelog.in control.in; do
  cat debian/$i | sed -e "s/@VERSION@/$VER/g" | sed -e "s/@DATE@/$DATE/g" >debian/`basename $i .in`
done

echo "Prepared Debian package files for version $VER."

