def has_program(cmd, args=['--version']):
 full_cmd = _convert_args(([cmd] + args))
 try:
  with open(os.devnull, 'wb') as devnull:
   subprocess.check_call(full_cmd, stderr=devnull, stdout=devnull, stdin=devnull)
 except OSError:
  return False
 except subprocess.CalledProcessError:
  return False
 else:
  return True

def has_program ( cmd , args = [ '--version' ] ) : full_cmd = _convert_args ( ( [ cmd ] + args ) ) try : with open ( os . devnull , 'wb' ) as devnull : subprocess . check_call ( full_cmd , stderr = devnull , stdout = devnull , stdin = devnull ) except OSError : return False except subprocess . CalledProcessError : return False else : return True
returns true if cmd can be executed .