qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

scripts/modules/module_block: Use Python 3 interpreter & add pseudo-main

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200512103238.7078-6-philmd@redhat.com>

+15 -14
+15 -14
scripts/modules/module_block.py
··· 1 - #!/usr/bin/python 1 + #!/usr/bin/env python3 2 2 # 3 3 # Module information generator 4 4 # ··· 80 80 #endif 81 81 ''') 82 82 83 - # First argument: output file 84 - # All other arguments: modules source files (.c) 85 - output_file = sys.argv[1] 86 - with open(output_file, 'w') as fheader: 87 - print_top(fheader) 83 + if __name__ == '__main__': 84 + # First argument: output file 85 + # All other arguments: modules source files (.c) 86 + output_file = sys.argv[1] 87 + with open(output_file, 'w') as fheader: 88 + print_top(fheader) 88 89 89 - for filename in sys.argv[2:]: 90 - if os.path.isfile(filename): 91 - process_file(fheader, filename) 92 - else: 93 - print("File " + filename + " does not exist.", file=sys.stderr) 94 - sys.exit(1) 90 + for filename in sys.argv[2:]: 91 + if os.path.isfile(filename): 92 + process_file(fheader, filename) 93 + else: 94 + print("File " + filename + " does not exist.", file=sys.stderr) 95 + sys.exit(1) 95 96 96 - print_bottom(fheader) 97 + print_bottom(fheader) 97 98 98 - sys.exit(0) 99 + sys.exit(0)