From: Alex Coplan Date: Thu, 19 Jun 2025 13:44:06 +0000 (+0100) Subject: contrib/mklog.py: Add main function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca8ea1d23e8b6798b6eb8c018957b25aa6f0db95;p=thirdparty%2Fgcc.git contrib/mklog.py: Add main function This adds a main() function to mklog.py (like e.g. check_GNU_style.py has), which makes it easier to import and invoke from another python script. This is useful when using a wrapper script to set up the python environment. Smoke tested by using the modified mklog.py to generate the ChangeLog for this patch. contrib/ChangeLog: * mklog.py (main): New. --- diff --git a/contrib/mklog.py b/contrib/mklog.py index dcf7dde6333..26d4156b034 100755 --- a/contrib/mklog.py +++ b/contrib/mklog.py @@ -360,7 +360,7 @@ def skip_line_in_changelog(line): return FIRST_LINE_OF_END_RE.match(line) is None -if __name__ == '__main__': +def main(): extra_args = os.getenv('GCC_MKLOG_ARGS') if extra_args: sys.argv += json.loads(extra_args) @@ -447,3 +447,6 @@ if __name__ == '__main__': f.write('\n'.join(end)) else: print(output, end='') + +if __name__ == '__main__': + main()