original_docstring: Extract the SDK installer into a given directory
  
    If the outdir already exists, then this function deletes it
  
    Args:
      installer: full path of the SDK installer
      outdir: output directory where to extract the installer
      bundle_name: name of sdk bundle within outdir
      nacl_sdk: filename of nacl_sdk tarball
  
    Raises:
      OSError - if the outdir already exists
      CalledProcessError - if the extract operation fails
    
docstring: Extract the SDK installer into a given directory
  If the outdir already exists, then this function deletes it
  
  full path of the SDK installer
  outdir: output directory where to extract the installer
  bundle_name: name of sdk bundle within outdir
  nacl_sdk: filename of nacl_sdk tarball
  
  if the outdir already exists
  CalledProcessError - if the extract operation fails
docstring_tokens: Extract the SDK installer into a given directory If the outdir already exists then this function deletes it full path of the SDK installer outdir : output directory where to extract the installer bundle_name : name of sdk bundle within outdir nacl_sdk : filename of nacl_sdk tarball if the outdir already exists CalledProcessError - if the extract operation fails
code: def ExtractInstaller(installer, outdir, bundle_name, nacl_sdk):
    '''Extract the SDK installer into a given directory
  
    If the outdir already exists, then this function deletes it
  
    Args:
      installer: full path of the SDK installer
      outdir: output directory where to extract the installer
      bundle_name: name of sdk bundle within outdir
      nacl_sdk: filename of nacl_sdk tarball
  
    Raises:
      OSError - if the outdir already exists
      CalledProcessError - if the extract operation fails
    '''
  
    annotator.Print('Extracting installer %s into %s' % (installer, outdir))
  
    if os.path.exists(outdir):
      RemoveDir(outdir)
  
    os.mkdir(outdir)
  
    if sys.platform == 'win32':
      zip_file = None
      try:
        zip_file = zipfile.ZipFile(nacl_sdk)
        zip_file.extractall(path=outdir)
      finally:
        if zip_file:
          zip_file.close()
    else:
      # Unfortunately, the zipfile module does not retain file permissions
      # when extracting executable scripts.  For now, just use the unzip
      # that comes with Linux and Mac.
      subprocess.check_call(['unzip', nacl_sdk], cwd=outdir)
  
    outdir = os.path.join(outdir, 'nacl_sdk')
  
    manifest_filename = os.path.join(outdir, 'test_manifest.json')
    update_manifest_options = [
         '--bundle-revision=1',
         '--bundle-version=2',
         '--description=installer_test bundle',
         '--%s-archive=file://%s' % (
             sdk_update.GetHostOS(),
             urllib.pathname2url(os.path.abspath(installer))),
         '--bundle-name=%s' % bundle_name,
         '--recommended=yes',
         '--stability=stable',
         '--manifest-version=1',
         '--manifest-file=%s' % manifest_filename]
    annotator.Print('Running update manifest with %s' % update_manifest_options)
    if 0 != update_manifest.main(update_manifest_options):
      raise Exception('update_manifest terminated abnormally.')
  
    naclsdk_options = [
         os.path.join(outdir,
                      'naclsdk.bat' if sys.platform == 'win32' else 'naclsdk'),
        '--manifest-url=file://%s' % urllib.pathname2url(manifest_filename),
        '--sdk-root-dir=%s' % outdir,
        '--user-data-dir=%s' % outdir,
        'update']
    annotator.Print('Running naclsdk with %s' % naclsdk_options)
    subprocess.check_call(naclsdk_options)
code_tokens: def ExtractInstaller ( installer , outdir , bundle_name , nacl_sdk ) : annotator . Print ( 'Extracting installer %s into %s' % ( installer , outdir ) ) if os . path . exists ( outdir ) : RemoveDir ( outdir ) os . mkdir ( outdir ) if sys . platform == 'win32' : zip_file = None try : zip_file = zipfile . ZipFile ( nacl_sdk ) zip_file . extractall ( path = outdir ) finally : if zip_file : zip_file . close ( ) else : subprocess . check_call ( [ 'unzip' , nacl_sdk ] , cwd = outdir ) outdir = os . path . join ( outdir , 'nacl_sdk' ) manifest_filename = os . path . join ( outdir , 'test_manifest.json' ) update_manifest_options = [ '--bundle-revision=1' , '--bundle-version=2' , '--description=installer_test bundle' , '--%s-archive=file://%s' % ( sdk_update . GetHostOS ( ) , urllib . pathname2url ( os . path . abspath ( installer ) ) ) , '--bundle-name=%s' % bundle_name , '--recommended=yes' , '--stability=stable' , '--manifest-version=1' , '--manifest-file=%s' % manifest_filename ] annotator . Print ( 'Running update manifest with %s' % update_manifest_options ) if 0 != update_manifest . main ( update_manifest_options ) : raise Exception ( 'update_manifest terminated abnormally.' ) naclsdk_options = [ os . path . join ( outdir , 'naclsdk.bat' if sys . platform == 'win32' else 'naclsdk' ) , '--manifest-url=file://%s' % urllib . pathname2url ( manifest_filename ) , '--sdk-root-dir=%s' % outdir , '--user-data-dir=%s' % outdir , 'update' ] annotator . Print ( 'Running naclsdk with %s' % naclsdk_options ) subprocess . check_call ( naclsdk_options )
short_docstring: Extract the SDK installer into a given directory
  If the outdir already exists, then this function deletes it
short_docstring_tokens: Extract the SDK installer into a given directory If the outdir already exists then this function deletes it
comment: '''Extract the SDK installer into a given directory
  
    If the outdir already exists, then this function deletes it
  
    Args:
      installer: full path of the SDK installer
      outdir: output directory where to extract the installer
      bundle_name: name of sdk bundle within outdir
      nacl_sdk: filename of nacl_sdk tarball
  
    Raises:
      OSError - if the outdir already exists
      CalledProcessError - if the extract operation fails
    '''$SEP$# Unfortunately, the zipfile module does not retain file permissions$SEP$# when extracting executable scripts.  For now, just use the unzip$SEP$# that comes with Linux and Mac.