check-code: factor out boot procedure into main
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 20 May 2016 09:47:35 +0900
changeset 29568 7825f6154a65
parent 29567 7e2b389418da
child 29569 3d52e7c78a6b
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
contrib/check-code.py
--- 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())