Skip to content
Permalink
Browse files
sipify: adds test to prepare-commit and adapt sipdiff
add missing macros to Doxyfile.in
  • Loading branch information
3nids committed Mar 30, 2017
1 parent 9846b34 commit f1d9d22a95aab46281a0b87701792ad29c51d7ed
Showing with 81 additions and 14 deletions.
  1. +3 −1 cmake_templates/Doxyfile.in
  2. +44 −0 scripts/prepare-commit.sh
  3. +34 −13 scripts/sipdiff
@@ -1357,7 +1357,9 @@ EXPAND_AS_DEFINED = "SIP_TRANSFER" \
"SIP_FACTORY" \
"SIP_KEEPREFERENCE" \
"SIP_PYNAME" \
"SIP_SKIP"
"SIP_SKIP" \
"SIP_PYDEFAULTVALUE" \
"SIP_PYTYPE"

# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
@@ -98,6 +98,50 @@ else
rm $ASTYLEDIFF
fi



# verify SIP files
SIPIFYDIFF=sipify.$REV.diff
>$SIPIFYDIFF
for f in $MODIFIED; do
# if cpp header
if [[ $f =~ ^src\/(core|gui|analysis)\/.*\.h$ ]]; then
# look if corresponding SIP file
#echo $f
sip_include=$(sed -r 's/^src\/(\w+)\/.*$/python\/\1\/\1.sip/' <<< $f )
sip_file=$(sed -r 's/^src\/(core|gui|analysis)\///; s/\.h$/.sip/' <<<$f )
if grep -Exq "^\s*%Include $sip_file" ${TOPLEVEL}/$sip_include ; then
#echo "in SIP"
sip_file=$(sed -r 's/^src\///; s/\.h$/.sip/' <<<$f )
# check it is not blacklisted (i.e. manualy SIP)
if ! grep -Fxq "$sip_file" python/auto_sip.blacklist; then
#echo "automatic file"
m=python/$sip_file.$REV.prepare
cp python/$sip_file $m
${TOPLEVEL}/scripts/sipify.pl $f > $m
if diff -u $m python/$sip_file >>$SIPIFYDIFF; then
# no difference found
rm $m
else
echo "python/$sip_file is not up to date"
fi
fi
fi
fi
done
if [[ -s "$SIPIFYDIFF" ]]; then
if tty -s; then
# review astyle changes
colordiff <$SIPIFYDIFF | less -r
else
echo "Files changed (see $ASTYLEDIFF)"
fi
exit 1
else
rm $SIPIFYDIFF
fi


exit 0

# vim: set ts=8 noexpandtab :
@@ -1,12 +1,17 @@
#!/usr/bin/env bash

# ARGUMENTS
REMOVE_COMMENTS=YES
while getopts ":c" opt; do
FORCE=NO
SIPIFY=NO
while getopts ":fs" opt; do
case $opt in
c)
# keep comments
REMOVE_COMMENTS=NO
s)
# sipify header
SIPIFY=YES
;;
f)
# force if sip is automatically generated
FORCE=YES
;;
\?)
echo "Invalid option: -$OPTARG" >&2
@@ -16,23 +21,39 @@ while getopts ":c" opt; do
done
shift $(expr $OPTIND - 1)

# GNU prefix command for mac os support (gsed, gsplit)
GP=
if [[ "$OSTYPE" =~ darwin* ]]; then
GP=g
fi


for file in $*; do
d=${file#*/}
d=${d%/*}
f=${file##*/}
f=${f%.*}
header="src/$d/$f.h"

tempfile=$(${GP}mktemp ${f}XXXX --suffix=.h)

./scripts/sipify.pl "src/$d/$f.h" > $tempfile
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

0 comments on commit f1d9d22

Please sign in to comment.