scripts/show_delta: add __main__ judgement before main code
authorHu Haowen <2023002089@link.tyut.edu.cn>
Fri, 13 Oct 2023 13:28:32 +0000 (21:28 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 18 Oct 2023 21:43:23 +0000 (14:43 -0700)
When doing Python programming it is a nice convention to insert the if
statement `if __name__ == "__main__":` before any main code that does
actual functionalities to ensure the code will be executed only as a
script rather than as an imported module.  Hence attach the missing
judgement to show_delta.

Link: https://lkml.kernel.org/r/20231013132832.165768-1-2023002089@link.tyut.edu.cn
Signed-off-by: Hu Haowen <2023002089@link.tyut.edu.cn>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nicolas Schier <n.schier@avm.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/show_delta

index 28e67e178194191bb1b4c2f5b02bc727470e67b1..291ad65e30894645205101e3f31f2e38e90e172e 100755 (executable)
@@ -125,4 +125,5 @@ def main():
        for line in lines:
                print (convert_line(line, base_time),)
 
-main()
+if __name__ == "__main__":
+       main()