Hi,

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.

OK to install?

Thanks,
Alex

contrib/ChangeLog:

        * mklog.py: Add main() function.
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()

Reply via email to