def DetermineRunner(bbdir):
 try:
  import buildbot_worker.scripts.runner
  tacfile = os.path.join(bbdir, 'buildbot.tac')
  if os.path.exists(tacfile):
   with open(tacfile, 'r') as f:
    contents = f.read()
    if ('import Worker' in contents):
     return buildbot_worker.scripts.runner.run
 except ImportError:
  pass
 import buildbot.scripts.runner
 return buildbot.scripts.runner.run

def DetermineRunner ( bbdir ) : try : import buildbot_worker . scripts . runner tacfile = os . path . join ( bbdir , 'buildbot.tac' ) if os . path . exists ( tacfile ) : with open ( tacfile , 'r' ) as f : contents = f . read ( ) if ( 'import Worker' in contents ) : return buildbot_worker . scripts . runner . run except ImportError : pass import buildbot . scripts . runner return buildbot . scripts . runner . run
checks if the given directory is a worker or a master and returns the appropriate run function .