#NEWLINE# def _install_bottle( env , brew_cmd , pkg , ipkgs ) : #NEWLINE# #INDENT# 'Install Linux bottles for brew packages that can be tricky to build.\n    ' #NEWLINE# if ( env . distribution == 'macosx' ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# ( pkg_version , is_linked ) = _latest_pkg_version ( env , brew_cmd , pkg ) #NEWLINE# install_version = ipkgs [ 'current' ] . get ( pkg ) #NEWLINE# if ( pkg_version == install_version ) : #NEWLINE# #INDENT# if ( not is_linked ) : #NEWLINE# #INDENT# env . safe_run ( ( '%s link --overwrite %s' % ( brew_cmd , pkg ) ) ) #NEWLINE# #UNINDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( install_version or ( pkg in ipkgs [ 'outdated' ] ) ) : #NEWLINE# #INDENT# env . safe_run ( '{brew_cmd} remove --force {pkg}' . format ( ** locals ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# url = BOTTLE_URL . format ( pkg = pkg , version = pkg_version ) #NEWLINE# brew_cachedir = env . safe_run_output ( ( '%s --cache' % brew_cmd ) ) #NEWLINE# brew_cellar = os . path . join ( env . safe_run_output ( ( '%s --prefix' % brew_cmd ) ) , 'Cellar' ) #NEWLINE# with quiet ( ) : #NEWLINE# #INDENT# env . safe_run ( ( 'mkdir -p %s' % brew_cellar ) ) #NEWLINE# #UNINDENT# out_file = os . path . join ( brew_cachedir , os . path . basename ( url ) ) #NEWLINE# if env . safe_exists ( out_file ) : #NEWLINE# #INDENT# env . safe_run ( ( 'rm -f %s' % out_file ) ) #NEWLINE# #UNINDENT# bottle_file = shared . _remote_fetch ( env , url , out_file = out_file , allow_fail = True , samedir = True ) #NEWLINE# if bottle_file : #NEWLINE# #INDENT# with cd ( brew_cellar ) : #NEWLINE# #INDENT# env . safe_run ( ( 'tar -xf %s' % bottle_file ) ) #NEWLINE# #UNINDENT# env . safe_run ( ( '%s link --overwrite %s' % ( brew_cmd , pkg ) ) ) #NEWLINE# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False