diff options
| author | Theofilos Augoustis <theofilos.augoustis@tum.de> | 2025-08-28 13:31:51 +0000 |
|---|---|---|
| committer | Theofilos Augoustis <theofilos.augoustis@tum.de> | 2025-08-28 13:31:51 +0000 |
| commit | 1ed51b9a902d7669c4dd26edf1a75d79c888bef4 (patch) | |
| tree | 30ecfa2ce98474fd4447d2dcf1814d4c16661602 /tools/convert.py | |
| parent | ff3c9a0136b1b308a06d01108157146cc315274b (diff) | |
| download | focaccia-1ed51b9a902d7669c4dd26edf1a75d79c888bef4.tar.gz focaccia-1ed51b9a902d7669c4dd26edf1a75d79c888bef4.zip | |
Refactor tool handling to match flake system
Diffstat (limited to 'tools/convert.py')
| -rwxr-xr-x | tools/convert.py | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/tools/convert.py b/tools/convert.py deleted file mode 100755 index f21a2fa..0000000 --- a/tools/convert.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import sys - -import focaccia.parser as parser -from focaccia.arch import supported_architectures - -convert_funcs = { - 'qemu': parser.parse_qemu, - 'arancini': parser.parse_arancini, -} - -def main(): - """Main.""" - prog = argparse.ArgumentParser() - prog.description = 'Convert other programs\' logs to focaccia\'s log format.' - prog.add_argument('file', help='The log to convert.') - prog.add_argument('--type', - required=True, - choices=convert_funcs.keys(), - help='The log type of `file`') - prog.add_argument('--output', '-o', - help='Output file (default is stdout)') - prog.add_argument('--arch', - default='x86_64', - choices=supported_architectures.keys(), - help='Processor architecture of input log (default is x86)') - args = prog.parse_args() - - # Parse arancini log - arch = supported_architectures[args.arch] - parse_log = convert_funcs[args.type] - with open(args.file, 'r') as in_file: - try: - snapshots = parse_log(in_file, arch) - except parser.ParseError as err: - print(f'Parse error: {err}. Exiting.', file=sys.stderr) - exit(1) - - # Write log in focaccia's format - if args.output: - with open(args.output, 'w') as out_file: - parser.serialize_snapshots(snapshots, out_file) - else: - parser.serialize_snapshots(snapshots, sys.stdout) - -if __name__ == '__main__': - main() |