Create given archive with given files.
346121
def create_archive(archive, filenames, verbosity=0, program=None, interactive=True):
    """"""
    util.check_new_filename(archive)
    util.check_archive_filelist(filenames)
    if verbosity >= 0:
        util.log_info("Creating %s ..." % archive)
    res = _create_archive(archive, filenames, verbosity=verbosity,
                          interactive=interactive, program=program)
    if verbosity >= 0:
        util.log_info("... %s created." % archive)
    return res
677509
def MakeZip(self, input_dir, output_file):
    
    logging.info("Generating zip template file at %s", output_file)
    basename, _ = os.path.splitext(output_file)
    # TODO(user):pytype: incorrect make_archive() definition in typeshed.
    # pytype: disable=wrong-arg-types
    shutil.make_archive(
        basename, "zip", base_dir=".", root_dir=input_dir, verbose=True)
1293212
public static function createArchive(array $files, $archiveFileName){
        if (count($files) > 1) return false;
        $filename = array_shift($files);
        if (is_null($filename)) return false; // invalid list
        if (file_put_contents($archiveFileName,
                static::compressData(file_get_contents($filename))) !== false)
            return 1;
    }
878033
def create_archive(path, remove_path=True):
    
    root_path = os.path.dirname(path)
    relative_path = os.path.basename(path)
    archive_path = path + ".tar.gz"

    cmd = [["tar", "-C", root_path, "-czf", archive_path, relative_path]]
    call(cmd, env=SAFE_ENV)
    if remove_path:
        fs.remove(path)
    return archive_path
776417
def unpack_archive(archive_format, archive_path, source_path):
    """"""
    if archive_format not in ('zip', 'tar'):
        raise ValueError('Unknown archive format "%s".' % archive_format)
    if archive_format == 'zip':
        with zipfile.ZipFile(archive_path) as archive:
            archive.extractall(source_path)
    if archive_format == 'tar':
        with tarfile.open(archive_path) as archive:
            archive.extractall(source_path)
1144356
def fetch_archive(savedir, url, fname, force=False):
    """"""
    dest = pjoin(savedir, fname)
    if os.path.exists(dest) and not force:
        info("already have %s" % fname)
        return dest
    info("fetching %s into %s" % (url, savedir))
    if not os.path.exists(savedir):
        os.makedirs(savedir)
    req = urlopen(url)
    with open(dest, 'wb') as f:
        f.write(req.read())
    return dest
1336524
protected ClassLoader createClassLoader(List<Archive> archives) throws Exception {
		List<URL> urls = new ArrayList<>(archives.size());
		for (Archive archive : archives) {
			urls.add(archive.getUrl());
		}
		return createClassLoader(urls.toArray(new URL[0]));
	}
903619
def extract_to_disk(self):
        """"""
        archive_name, extension = os.path.splitext(os.path.basename(self.file.name))
        if not os.path.isdir(os.path.join(os.getcwd(), archive_name)):
            os.mkdir(archive_name)
        os.chdir(archive_name)
        for filename, data in self.extract().items():
            f = open(filename, 'wb')
            f.write(data or b'')
            f.close()
609616
def create_archive_info(filepath, extracted_path, archive_sha=None):
    

    archive_info = {
        "sha1": archive_sha,
        "filename": os.path.split(filepath)[1],
    }

    with io.open(
        os.path.join(
            extracted_path,
            ".slackviewer_archive_info.json",
        ), 'w+', encoding="utf-8"
    ) as f:
        s = json.dumps(archive_info, ensure_ascii=False)
        s = to_unicode(s)
        f.write(s)
646215
def create_directory(directory):
    """"""
    if os.path.exists(directory):
        rmtree(directory)
    os.makedirs(directory)
    return directory
415099
def render_archive(entries):
    """"""
    context = GLOBAL_TEMPLATE_CONTEXT.copy()
    context['entries'] = entries
    _render(context, 'archive_index.html',
            os.path.join(CONFIG['output_to'], 'archive/index.html')),
38132
def create_singlefile_standard (archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    cmdlist = [util.shell_quote(cmd)]
    if verbosity > 1:
        cmdlist.append('-v')
    cmdlist.extend(['-c', '--'])
    cmdlist.extend([util.shell_quote(x) for x in filenames])
    cmdlist.extend(['>', util.shell_quote(archive)])
    return (cmdlist, {'shell': True})
205173
def makedirs(path, mode=0o777, exist_ok=False):
    """"""
    os.makedirs(path, mode, exist_ok)
204785
def _create_archive(self):
        ''''''
        try:
            self.archive_path = os.path.join(self.report_dir, "%s.tar.gz" % self.session)
            self.logger.con_out('Creating SOSCleaner Archive - %s', self.archive_path)
            t = tarfile.open(self.archive_path, 'w:gz')
            for dirpath, dirnames, filenames in os.walk(self.dir_path):
                for f in filenames:
                    f_full = os.path.join(dirpath, f)
                    f_archive = f_full.replace(self.report_dir,'')
                    self.logger.debug('adding %s to %s archive', f_archive, self.archive_path)
                    t.add(f_full, arcname=f_archive)
        except Exception as e: #pragma: no cover
            self.logger.exception(e)
            raise Exception('CreateArchiveError: Unable to create Archive')

        self._clean_up()
        self.logger.info('Archiving Complete')
        self.logger.con_out('SOSCleaner Complete')
        if not self.quiet:  # pragma: no cover
            t.add(self.logfile, arcname=self.logfile.replace(self.report_dir,''))
        t.close()
189609
def create_ar (archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    opts = 'rc'
    if verbosity > 1:
        opts += 'v'
    cmdlist = [cmd, opts, archive]
    cmdlist.extend(filenames)
    return cmdlist
242711
def extract_archive(archive_path, destination_path):
    """"""
    tar = tarfile.open(archive_path)
    tar.errorlevel = 1
    tar.extractall(destination_path)
1215160
protected void assembleArchive() throws Exception {
        getLog().info("Assembling " + classifier + " archive");
        
        if (resources != null && !resources.isEmpty()) {
            getLog().info("Copying additional resources.");
            new ResourceProcessor(this, moduleBase, resources).transform();
        }
        
        if (configTemplate != null) {
            getLog().info("Creating config file.");
            configTemplate.addEntry("info", pluginDescriptor.getName(), pluginDescriptor.getVersion(),
                new Date().toString());
            configTemplate.createFile(stagingDirectory);
        }
        
        try {
            File archive = createArchive();
            
            if ("war".equalsIgnoreCase(mavenProject.getPackaging()) && this.warInclusion) {
                webappLibDirectory.mkdirs();
                File webappLibArchive = new File(this.webappLibDirectory, archive.getName());
                Files.copy(archive, webappLibArchive);
            }
        } catch (Exception e) {
            throw new RuntimeException("Exception occurred assembling archive.", e);
        }
        
    }