parameters: (toolset_root, url)
docstring: Downloads and installs Go toolset.
  
    GOROOT would be <toolset_root>/go/.
docstring_summary: Downloads and installs Go toolset.
docstring_tokens: Downloads and installs Go toolset .
function: def install_toolset(toolset_root, url):
    """Downloads and installs Go toolset.
  
    GOROOT would be <toolset_root>/go/.
    """
    if not os.path.exists(toolset_root):
      os.makedirs(toolset_root)
    pkg_path = os.path.join(toolset_root, url[url.rfind('/')+1:])
  
    LOGGER.info('Downloading %s...', url)
    download_file(url, pkg_path)
  
    LOGGER.info('Extracting...')
    if pkg_path.endswith('.zip'):
      with zipfile.ZipFile(pkg_path, 'r') as f:
        f.extractall(toolset_root)
    elif pkg_path.endswith('.tar.gz'):
      with tarfile.open(pkg_path, 'r:gz') as f:
        f.extractall(toolset_root)
    else:
      raise Failure('Unrecognized archive format')
  
    LOGGER.info('Validating...')
    if not check_hello_world(toolset_root):
      raise Failure('Something is not right, test program doesn\'t work')
function_tokens: def install_toolset ( toolset_root , url ) : if not os . path . exists ( toolset_root ) : os . makedirs ( toolset_root ) pkg_path = os . path . join ( toolset_root , url [ url . rfind ( '/' ) + 1 : ] ) LOGGER . info ( 'Downloading %s...' , url ) download_file ( url , pkg_path ) LOGGER . info ( 'Extracting...' ) if pkg_path . endswith ( '.zip' ) : with zipfile . ZipFile ( pkg_path , 'r' ) as f : f . extractall ( toolset_root ) elif pkg_path . endswith ( '.tar.gz' ) : with tarfile . open ( pkg_path , 'r:gz' ) as f : f . extractall ( toolset_root ) else : raise Failure ( 'Unrecognized archive format' ) LOGGER . info ( 'Validating...' ) if not check_hello_world ( toolset_root ) : raise Failure ( 'Something is not right, test program doesn\'t work' )