https://gcc.gnu.org/g:ca8ea1d23e8b6798b6eb8c018957b25aa6f0db95

commit r16-1711-gca8ea1d23e8b6798b6eb8c018957b25aa6f0db95
Author: Alex Coplan <alex.cop...@arm.com>
Date:   Thu Jun 19 14:44:06 2025 +0100

    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:
---
 contrib/mklog.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/mklog.py b/contrib/mklog.py
index dcf7dde63336..26d4156b0340 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()

Reply via email to