]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
contrib/mklog.py: Add main function
authorAlex Coplan <alex.coplan@arm.com>
Thu, 19 Jun 2025 13:44:06 +0000 (14:44 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Thu, 26 Jun 2025 14:42:44 +0000 (15:42 +0100)
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.

contrib/mklog.py

index dcf7dde6333684f2a556e255bac8c5aa59fa1ea6..26d4156b0340c77c6207467d0a32cfaf9115c798 100755 (executable)
@@ -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()