PY3: change shebang to python3 in script dir
[garming/samba-autobuild/.git] / script / bisect-test.py
index a80baff936fa2d383ea5218b65035ded1a54b623..313c4e3c6ce9f3f6485a5da18af36159849cb903 100755 (executable)
@@ -1,11 +1,13 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # use git bisect to work out what commit caused a test failure
 # Copyright Andrew Tridgell 2010
 # released under GNU GPL v3 or later
 
 
 from subprocess import call, check_call, Popen, PIPE
-import os, tempfile, sys
+import os
+import tempfile
+import sys
 from optparse import OptionParser
 
 parser = OptionParser()
@@ -13,11 +15,11 @@ parser.add_option("", "--good", help="known good revision (default HEAD~100)", d
 parser.add_option("", "--bad", help="known bad revision (default HEAD)", default='HEAD')
 parser.add_option("", "--skip-build-errors", help="skip revision where make fails",
                   action='store_true', default=False)
-parser.add_option("", "--autogen", help="run autogen before each build",action="store_true", default=False)
+parser.add_option("", "--autogen", help="run autogen before each build", action="store_true", default=False)
 parser.add_option("", "--autogen-command", help="command to use for autogen (default ./autogen.sh)",
                   type='str', default="./autogen.sh")
 parser.add_option("", "--configure", help="run configure.developer before each build",
-    action="store_true", default=False)
+                  action="store_true", default=False)
 parser.add_option("", "--configure-command", help="the command for configure (default ./configure.developer)",
                   type='str', default="./configure.developer")
 parser.add_option("", "--build-command", help="the command to build the tree (default 'make -j')",
@@ -41,15 +43,17 @@ def run_cmd(cmd, dir=".", show=True, output=False, checkfail=True):
     else:
         return call(cmd, shell=True, cwd=dir)
 
+
 def find_git_root():
     '''get to the top of the git repo'''
-    p=os.getcwd()
+    p = os.getcwd()
     while p != '/':
         if os.path.isdir(os.path.join(p, ".git")):
             return p
         p = os.path.abspath(os.path.join(p, '..'))
     return None
 
+
 cwd = os.getcwd()
 gitroot = find_git_root()
 
@@ -72,11 +76,13 @@ f.write("%s || exit 1\n" % opts.test_command)
 f.write("exit 0\n")
 f.close()
 
+
 def cleanup():
     run_cmd("git bisect reset", dir=gitroot)
     os.unlink(f.name)
     sys.exit(-1)
 
+
 # run bisect
 ret = -1
 try: