File: sipdiff

package info (click to toggle)
qgis 3.40.15%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,185,444 kB
  • sloc: cpp: 1,616,454; python: 372,967; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,829; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 155
file content (67 lines) | stat: -rwxr-xr-x 1,342 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/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.blocklist; 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