From 674cacb6c77a926ee4d2896108613a80018c5c4c Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Sun, 20 Feb 2022 03:42:38 +0100 Subject: [PATCH 3/3] generate_packets.py: Allow importing and calling with custom parameters See osdn #43939 Signed-off-by: Alina Lenk --- common/generate_packets.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/generate_packets.py b/common/generate_packets.py index 4be955bbc8..9718adbc70 100755 --- a/common/generate_packets.py +++ b/common/generate_packets.py @@ -1877,10 +1877,10 @@ def strip_c_comment(s): # Main function. It reads and parses the input and generates the # various files. -def main(): +def main(raw_args=None): ### parsing arguments global is_verbose - script_args = get_argparser().parse_args() + script_args = get_argparser().parse_args(raw_args) is_verbose = script_args.verbose ### parsing input @@ -2234,4 +2234,6 @@ bool client_handle_packet(enum packet_type type, const void *packet) ''') f.close() -main() + +if __name__ == "__main__": + main() -- 2.17.1