Skip to content
Permalink
Browse files
sipify scripts fixes
* fix prepare-commit.sh when SIP file is not created yet
* raise an error if header doesn't have EXPORT macro for class definition
* sipdiff can generate the SIP file on demand
  • Loading branch information
3nids committed Mar 30, 2017
1 parent f1d9d22 commit 4322c87c1ea86eaa636bfc5e0a031d210d17da92
Showing with 31 additions and 19 deletions.
  1. +1 −0 scripts/prepare-commit.sh
  2. +26 −18 scripts/sipdiff
  3. +4 −1 scripts/sipify.pl
@@ -117,6 +117,7 @@ for f in $MODIFIED; do
if ! grep -Fxq "$sip_file" python/auto_sip.blacklist; then
#echo "automatic file"
m=python/$sip_file.$REV.prepare
touch python/$sip_file
cp python/$sip_file $m
${TOPLEVEL}/scripts/sipify.pl $f > $m
if diff -u $m python/$sip_file >>$SIPIFYDIFF; then
@@ -1,18 +1,15 @@
#!/usr/bin/env bash

DIR=$(git rev-parse --show-toplevel)

# ARGUMENTS
FORCE=NO
SIPIFY=NO
while getopts ":fs" opt; do
while getopts ":s" 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
@@ -31,24 +28,35 @@ for file in $*; do
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 -e "\033[0;31m$d/$f.sip is an automatically generated SIP file\033[0m"
echo -e " g) \x1B[4mg\x1B[0menerate the SIP file \033[0;32m./sripts/sipify.pl $header > $d/$f.sip\033[0m"
echo -e " s) \x1B[4ms\x1B[0mhow the diff"
SHOW=NO
while read -n 1 n; do
echo ""
fi
if [[ $FORCE =~ NO ]]; then
case $n in
g)
echo "Genreating the SIP file ..."
${DIR}/scripts/sipify.pl ${DIR}/$header > ${DIR}/python/$d/$f.sip
break
;;
s)
SHOW=YES
break
;;
*)
invalid option
;;
esac
done
if [[ $SHOW =~ NO ]]; then
continue
fi
fi

if [[ $SIPIFY =~ YES ]]; then
tempfile=$(${GP}mktemp ${f}XXXX --suffix=.h)
./scripts/sipify.pl $header > $tempfile
tempfile=$(mktemp ${DIR}/${f}XXXX --suffix=.h)
${DIR}/scripts/sipify.pl ${DIR}/$header > $tempfile
else
tempfile=$header
fi
@@ -172,7 +172,10 @@
}

# class declaration started
if ( $line =~ m/^(\s*class)\s*([A-Z]+_EXPORT)(\s+\w+)(\s*\:.*)?$/ ){
if ( $line =~ m/^(\s*class)\s*([A-Z]+_EXPORT)?(\s+\w+)(\s*\:.*)?$/ ){
do {no warnings 'uninitialized';
$line =~ m/\bCORE_EXPORT\b/ or die 'Class shoud be exported with appropriate [LIB]_EXPORT macro.';
};
$line = "$1$3";
# Inheritance
if ($4){

0 comments on commit 4322c87

Please sign in to comment.