https://github.com/qgis/QGIS
Raw File
Tip revision: e83d02e2747dd3e4e6940d9d720fee80febe78d9 authored by Juergen E. Fischer on 17 January 2020, 12:10:04 UTC
Release of 3.4.15
Tip revision: e83d02e
sipdiff
#!/usr/bin/env bash

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

# ARGUMENTS
SIPIFY=NO
while getopts ":s" opt; do
  case $opt in
    s)
      # sipify header
      SIPIFY=YES
      ;;
    \?)
      echo "Invalid option: -$OPTARG" >&2
      exit 1
      ;;
  esac
done
shift $(($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 an automatically generated SIP file\033[0m"
    echo -e "  g) \x1B[4mg\x1B[0menerate the SIP file \033[0;32m./scripts/sipify.pl $header > python/$d/$f.sip\033[0m"
    echo -e "  s) \x1B[4ms\x1B[0mhow the diff"
    SHOW=NO
    while read -n 1 n; do
      echo ""
      case $n in
        g)
          echo "Generating the SIP file ..."
          pushd ${DIR}
          ./scripts/sipify.pl $header > python/$d/$f.sip
          popd
          break
          ;;
        s)
          SHOW=YES
          break
          ;;
        *)
         invalid option
         ;;
      esac
    done
    if [[ $SHOW =~ NO ]]; then
      continue
    fi
  fi

  if [[ $SIPIFY =~ YES ]]; then
    tempfile=$(mktemp ${DIR}/${f}XXXX --suffix=.h)
    ${DIR}/scripts/sipify.pl ${DIR}/$header > $tempfile
  else
    tempfile=$header
  fi
  vimdiff $tempfile python/$d/$f.sip

done
back to top