def get_homebrew_path(formula=''):
 import subprocess
 brewcmd = ['brew', '--prefix']
 path = None
 if formula:
  brewcmd.append(formula)
  dbgstr = ('homebrew formula "%s"' % formula)
 else:
  dbgstr = 'homebrew prefix'
 try:
  path = subprocess.check_output(brewcmd).strip()
  logger.debug(('Found %s at "%s"' % (dbgstr, path)))
 except OSError:
  logger.debug('Detected homebrew not installed')
 except subprocess.CalledProcessError:
  logger.debug(('homebrew formula "%s" not installed' % formula))
 if path:
  if is_py3:
   path = path.decode('utf8')
  return path
 else:
  return None

def get_homebrew_path ( formula = '' ) : import subprocess brewcmd = [ 'brew' , '--prefix' ] path = None if formula : brewcmd . append ( formula ) dbgstr = ( 'homebrew formula "%s"' % formula ) else : dbgstr = 'homebrew prefix' try : path = subprocess . check_output ( brewcmd ) . strip ( ) logger . debug ( ( 'Found %s at "%s"' % ( dbgstr , path ) ) ) except OSError : logger . debug ( 'Detected homebrew not installed' ) except subprocess . CalledProcessError : logger . debug ( ( 'homebrew formula "%s" not installed' % formula ) ) if path : if is_py3 : path = path . decode ( 'utf8' ) return path else : return None
return the homebrew path to the requested formula .