File: rdiff_backup_classes.sh

package info (click to toggle)
rdiff-backup 2.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,640 kB
  • sloc: python: 24,129; javascript: 9,512; sh: 1,230; ansic: 580; makefile: 36
file content (34 lines) | stat: -rwxr-xr-x 1,028 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -x
# script to document classes from Python sources

BASE_DIR=$(dirname $0)/../../src
PUML_FILE=$(realpath ${0%.sh}.puml)

cd ${BASE_DIR}
grep -r --include \*.py ^class | sort | awk -F'[:()]*' '
        BEGIN {
                print "@startuml"
        }
        {
                gsub(".py$", "", $1)
                gsub("^.*/", "", $1)
                gsub("^class *", "", $2)
                if ($1 != package) {
                        if (package) { print "}" }
                        package = $1
                        print "package " package " {"
                }
		if ($3 == "Exception" || $2 == "Exception" || $2 ~ /Error$/) {
			print "	class " $2 " << (E,#FF7700) Exception >>"
		} else {
			print "	class " $2
		}
		# the Exception descendence is marked by coloring not by arrows
                if ($3 && $3 != "Exception") print "	" $3 " <|-- " $2
        }
        END {
                if (package) print "}"
                print "@enduml"
        }' > ${PUML_FILE}

plantuml -tsvg ${PUML_FILE}