QGIS/scripts/sipdiff
Denis Rouzaud f1d9d22a95 sipify: adds test to prepare-commit and adapt sipdiff
add missing macros to Doxyfile.in
2017-03-30 15:13:01 +02:00

60 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# ARGUMENTS
FORCE=NO
SIPIFY=NO
while getopts ":fs" opt; do
case $opt in
s)
# sipify header
SIPIFY=YES
;;
f)
# force if sip is automatically generated
FORCE=YES
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
esac
done
shift $(expr $OPTIND - 1)
for file in $*; do
d=${file#*/}
d=${d%/*}
f=${file##*/}
f=${f%.*}
header="src/$d/$f.h"
if ! grep -Fxq "$d/$f.sip" python/auto_sip.blacklist; then
echo -e "\033[0;31m$d/$f.sip is automatically generated using sipify.pl script\033[0m"
echo "use following command to generate the SIP file:"
echo -e " \033[0;32m./sripts/sipify.pl $header > $d/$f.sip\033[0m"
if [[ $FORCE =~ NO ]]; then
echo "use -f argument to force showing the diff"
fi
if [[ $(wc -w <<< "$input") -eq "1" ]]; then
read -n 1 -s -p "Press any key to continue"
echo ""
fi
if [[ $FORCE =~ NO ]]; then
continue
fi
fi
if [[ $SIPIFY =~ YES ]]; then
tempfile=$(${GP}mktemp ${f}XXXX --suffix=.h)
./scripts/sipify.pl $header > $tempfile
else
tempfile=$header
fi
vimdiff $tempfile python/$d/$f.sip
rm $tempfile
done