mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
e57a707a82
commit
5aa628045d
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Module information generator
|
# Module information generator
|
||||||
#
|
#
|
||||||
|
@ -80,19 +80,20 @@ def print_bottom(fheader):
|
||||||
#endif
|
#endif
|
||||||
''')
|
''')
|
||||||
|
|
||||||
# First argument: output file
|
if __name__ == '__main__':
|
||||||
# All other arguments: modules source files (.c)
|
# First argument: output file
|
||||||
output_file = sys.argv[1]
|
# All other arguments: modules source files (.c)
|
||||||
with open(output_file, 'w') as fheader:
|
output_file = sys.argv[1]
|
||||||
print_top(fheader)
|
with open(output_file, 'w') as fheader:
|
||||||
|
print_top(fheader)
|
||||||
|
|
||||||
for filename in sys.argv[2:]:
|
for filename in sys.argv[2:]:
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
process_file(fheader, filename)
|
process_file(fheader, filename)
|
||||||
else:
|
else:
|
||||||
print("File " + filename + " does not exist.", file=sys.stderr)
|
print("File " + filename + " does not exist.", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
print_bottom(fheader)
|
print_bottom(fheader)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in New Issue