mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
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
This commit is contained in:
parent
f1d9d22a95
commit
4322c87c1e
@ -117,6 +117,7 @@ for f in $MODIFIED; do
|
|||||||
if ! grep -Fxq "$sip_file" python/auto_sip.blacklist; then
|
if ! grep -Fxq "$sip_file" python/auto_sip.blacklist; then
|
||||||
#echo "automatic file"
|
#echo "automatic file"
|
||||||
m=python/$sip_file.$REV.prepare
|
m=python/$sip_file.$REV.prepare
|
||||||
|
touch python/$sip_file
|
||||||
cp python/$sip_file $m
|
cp python/$sip_file $m
|
||||||
${TOPLEVEL}/scripts/sipify.pl $f > $m
|
${TOPLEVEL}/scripts/sipify.pl $f > $m
|
||||||
if diff -u $m python/$sip_file >>$SIPIFYDIFF; then
|
if diff -u $m python/$sip_file >>$SIPIFYDIFF; then
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIR=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
# ARGUMENTS
|
# ARGUMENTS
|
||||||
FORCE=NO
|
|
||||||
SIPIFY=NO
|
SIPIFY=NO
|
||||||
while getopts ":fs" opt; do
|
while getopts ":s" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
s)
|
s)
|
||||||
# sipify header
|
# sipify header
|
||||||
SIPIFY=YES
|
SIPIFY=YES
|
||||||
;;
|
;;
|
||||||
f)
|
|
||||||
# force if sip is automatically generated
|
|
||||||
FORCE=YES
|
|
||||||
;;
|
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -$OPTARG" >&2
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -31,24 +28,35 @@ for file in $*; do
|
|||||||
header="src/$d/$f.h"
|
header="src/$d/$f.h"
|
||||||
|
|
||||||
if ! grep -Fxq "$d/$f.sip" python/auto_sip.blacklist; then
|
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 -e "\033[0;31m$d/$f.sip is an automatically generated SIP file\033[0m"
|
||||||
echo "use following command to generate the SIP file:"
|
echo -e " g) \x1B[4mg\x1B[0menerate the SIP file \033[0;32m./sripts/sipify.pl $header > $d/$f.sip\033[0m"
|
||||||
echo -e " \033[0;32m./sripts/sipify.pl $header > $d/$f.sip\033[0m"
|
echo -e " s) \x1B[4ms\x1B[0mhow the diff"
|
||||||
if [[ $FORCE =~ NO ]]; then
|
SHOW=NO
|
||||||
echo "use -f argument to force showing the diff"
|
while read -n 1 n; do
|
||||||
fi
|
|
||||||
if [[ $(wc -w <<< "$input") -eq "1" ]]; then
|
|
||||||
read -n 1 -s -p "Press any key to continue"
|
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
case $n in
|
||||||
if [[ $FORCE =~ NO ]]; then
|
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
|
continue
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $SIPIFY =~ YES ]]; then
|
if [[ $SIPIFY =~ YES ]]; then
|
||||||
tempfile=$(${GP}mktemp ${f}XXXX --suffix=.h)
|
tempfile=$(mktemp ${DIR}/${f}XXXX --suffix=.h)
|
||||||
./scripts/sipify.pl $header > $tempfile
|
${DIR}/scripts/sipify.pl ${DIR}/$header > $tempfile
|
||||||
else
|
else
|
||||||
tempfile=$header
|
tempfile=$header
|
||||||
fi
|
fi
|
||||||
|
@ -172,7 +172,10 @@ while(!eof $header){
|
|||||||
}
|
}
|
||||||
|
|
||||||
# class declaration started
|
# 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";
|
$line = "$1$3";
|
||||||
# Inheritance
|
# Inheritance
|
||||||
if ($4){
|
if ($4){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user