changeset 29568:7825f6154a65

check-code: factor out boot procedure into main This is a part of preparation for adding check-code.py extra checks by another python script in subsequent patch. This is also useful for SkeletonExtensionPlan. https://www.mercurial-scm.org/wiki/SkeletonExtensionPlan
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 20 May 2016 09:47:35 +0900
parents 7e2b389418da
children 3d52e7c78a6b
files contrib/check-code.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Fri May 20 09:47:35 2016 +0900
+++ b/contrib/check-code.py	Fri May 20 09:47:35 2016 +0900
@@ -622,7 +622,7 @@
 
     return result
 
-if __name__ == "__main__":
+def main():
     parser = optparse.OptionParser("%prog [options] [files]")
     parser.add_option("-w", "--warnings", action="store_true",
                       help="include warning-level checks")
@@ -650,4 +650,7 @@
                          blame=options.blame, debug=options.debug,
                          lineno=options.lineno):
             ret = 1
-    sys.exit(ret)
+    return ret
+
+if __name__ == "__main__":
+    sys.exit(main())