parameters: (input_dir, format)
docstring: Creates a 7z archive of the specified input directory.
docstring_summary: Creates a 7z archive of the specified input directory.
docstring_tokens: Creates a 7z archive of the specified input directory .
function: def create_7z_archive(input_dir, format):
    """ Creates a 7z archive of the specified input directory. """
    # CEF_COMMAND_7ZIP might be "c:\Program Files (x86)\7Zip\7z.exe" or /usr/bin/7za
    # or simply 7z if the user knows that it's in the PATH var. Supported formats
    # depend on the 7za version -- check the 7-zip documentation for details.
    command = os.environ['CEF_COMMAND_7ZIP']
    working_dir = os.path.abspath(os.path.join(input_dir, os.pardir))
  
    tar_file = None
    if format in ('xz', 'gzip', 'bzip2'):
      # These formats only support one file per archive. Create a tar file first.
      tar_file = input_dir + '.tar'
      run('"%s" a -ttar -y %s %s' % (command, tar_file, input_dir), working_dir)
      zip_file = tar_file + '.' + format
      zip_input = tar_file
    else:
      zip_file = input_dir + '.' + format
      zip_input = input_dir
  
    # Create the compressed archive.
    run('"%s" a -t%s -y %s %s' % (command, format, zip_file, zip_input), working_dir)
  
    if not tar_file is None:
      remove_file(tar_file)
function_tokens: def create_7z_archive ( input_dir , format ) : # CEF_COMMAND_7ZIP might be "c:\Program Files (x86)\7Zip\7z.exe" or /usr/bin/7za # or simply 7z if the user knows that it's in the PATH var. Supported formats # depend on the 7za version -- check the 7-zip documentation for details. command = os . environ [ 'CEF_COMMAND_7ZIP' ] working_dir = os . path . abspath ( os . path . join ( input_dir , os . pardir ) ) tar_file = None if format in ( 'xz' , 'gzip' , 'bzip2' ) : # These formats only support one file per archive. Create a tar file first. tar_file = input_dir + '.tar' run ( '"%s" a -ttar -y %s %s' % ( command , tar_file , input_dir ) , working_dir ) zip_file = tar_file + '.' + format zip_input = tar_file else : zip_file = input_dir + '.' + format zip_input = input_dir # Create the compressed archive. run ( '"%s" a -t%s -y %s %s' % ( command , format , zip_file , zip_input ) , working_dir ) if not tar_file is None : remove_file ( tar_file )