diff options
Diffstat (limited to 'scripts/gen-crashhandler-default-go.py')
-rwxr-xr-x | scripts/gen-crashhandler-default-go.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/scripts/gen-crashhandler-default-go.py b/scripts/gen-crashhandler-default-go.py deleted file mode 100755 index e080ed9..0000000 --- a/scripts/gen-crashhandler-default-go.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import argparse -import kconfiglib -import re - -def findItem(node, name): - while node: - if isinstance(node.item, kconfiglib.Symbol): - if node.item.name == name: - return node.item.str_value - - if node.list: - found = findItem(node.list, name) - if found is not None: - return found - - node = node.next - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument("--kconfig", nargs="?", default="Kconfig", help="Top-level Kconfig") - parser.add_argument("--dotconfig", nargs="?", help=".config") - parser.add_argument("--input", type=argparse.FileType('r'), help="default.go.in") - parser.add_argument("--output", type=argparse.FileType('w'), default=sys.stdout, help="Output location") - args = parser.parse_args() - - kconf = kconfiglib.Kconfig(args.kconfig) - if args.dotconfig is not None: - kconf.load_config(args.dotconfig) - - marker = re.compile('.+(@(\w+)@)') - for line in args.input: - found = marker.match(line) - if found: - print(str.replace(line, found.group(1), findItem(kconf.top_node, found.group(2))), end='', file=args.output) - else: - print(line, end='', file=args.output) - |