Creates a zip file from a module.
774493
private File zipModule(ModuleIdentifier modID) {
    File modDir = new File(modRoot, modID.toString());
    if (!modDir.exists()) {
      throw new PlatformManagerException("Cannot find module");
    }

    // Create a temporary directory in which to store the module and its dependencies.
    File modRoot = new File(TEMP_DIR, "vertx-zip-mods");

    // Create a zip file. If the zip file already exists in the temporary
    // Vertigo zips directory then just return the existing zip file.
    File zipFile = new File(modRoot, modID.toString() + ".zip");
    if (zipFile.exists()) {
      return zipFile;
    }

    // Create a temporary directory to which we'll copy the module and its dependencies.
    File modDest = new File(modRoot, modID.toString() + "-" + UUID.randomUUID().toString());
    File modHome = new File(modDest, modID.toString());

    // Create the temporary destination directory.
    vertx.fileSystem().mkdirSync(modHome.getAbsolutePath(), true);

    // Copy the module into the temporary directory.
    vertx.fileSystem().copySync(modDir.getAbsolutePath(), modHome.getAbsolutePath(), true);

    // Pull any module dependencies ("includes" and "deploys") into the temporary directory.
    pullInDependencies(modID, modHome);

    // Zip up the temporary directory into the zip file.
    zipDirectory(zipFile.getPath(), modDest.getAbsolutePath());

    // Delete the temporary directory.
    vertx.fileSystem().deleteSync(modDest.getAbsolutePath(), true);
    return zipFile;
  }
838522
def create_zpaq(archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    cmdlist = [cmd, 'a', archive]
    cmdlist.extend(filenames)
    cmdlist.extend(['-method', '4'])
    return cmdlist
1135217
public File createArchive() throws IOException, ZipException {
		File tmpFile = File.createTempFile("dw-data", ".zip");
		try {
			tmpFile.delete();

			ZipFile zipFile = new ZipFile(tmpFile.getAbsoluteFile());
			ZipParameters parameters = new ZipParameters();
			parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_ULTRA);
			parameters.setIncludeRootFolder(false);
			zipFile.addFolder(tempDir.toFile(), parameters);

		} finally {
			dispose();
		}
		return tmpFile;
	}
893468
def MakeDeployableBinary(self, template_path, output_path):
    """"""
    context = self.context + ["Client Context"]
    utils.EnsureDirExists(os.path.dirname(output_path))

    client_config_data = self.GetClientConfig(context)
    shutil.copyfile(template_path, output_path)
    zip_file = zipfile.ZipFile(output_path, mode="a")
    zip_info = zipfile.ZipInfo(filename="config.yaml")
    zip_file.writestr(zip_info, client_config_data)
    zip_file.close()
    return output_path
1207118
def _to_zipfile(self, file_generator):
        
        with zipfile.ZipFile(file_generator.to_path, mode="w", compression=zipfile.ZIP_DEFLATED) as outfile:
            for f in file_generator:
                outpath = self._output_path(f.source, file_generator.to_format, archive=True)
                outfile.writestr(outpath, f.writestr(file_generator.to_format))
869128
def create_module(project, name, sourcefolder=None):
    """"""
    if sourcefolder is None:
        sourcefolder = project.root
    packages = name.split('.')
    parent = sourcefolder
    for package in packages[:-1]:
        parent = parent.get_child(package)
    return parent.create_file(packages[-1] + '.py')
1320605
def create_package_file(root, master_package, subroot, py_files, opts, subs):
    """"""
    text = format_heading(1, '%s' % makename(master_package, subroot))

    if opts.modulefirst:
        text += format_directive(subroot, master_package)
        text += '\n'

    # build a list of directories that are szvpackages (contain an INITPY file)
    subs = [sub for sub in subs if path.isfile(path.join(root, sub, INITPY))]
    # if there are some package directories, add a TOC for theses subpackages
    if subs:
        # text += format_heading(2, 'Subpackages')
        text += '.. toctree::\n\n'
        for sub in subs:
            text += '    %s.%s\n' % (makename(master_package, subroot), sub)
        text += '\n'

    submods = [path.splitext(sub)[0] for sub in py_files
               if not shall_skip(path.join(root, sub), opts) and
               sub != INITPY]
    if submods:
        #text += format_heading(2, 'Submodules')
        if opts.separatemodules:
            text += '.. toctree::\n\n'
            for submod in submods:
                modfile = makename(master_package, makename(subroot, submod))
                text += '   %s\n' % modfile

                # generate separate file for this module
                if not opts.noheadings:
                    filetext = format_heading(1, '%s module' % modfile)
                else:
                    filetext = ''
                filetext += format_directive(makename(subroot, submod),
                                             master_package)
                write_file(modfile, filetext, opts)
        else:
            for submod in submods:
                modfile = makename(master_package, makename(subroot, submod))
                if not opts.noheadings:
                    text += format_heading(2, '%s module' % modfile)
                text += format_directive(makename(subroot, submod),
                                         master_package)
                text += '\n'
        text += '\n'

    if not opts.modulefirst:
        text += format_heading(2, 'Module contents')
        text += format_directive(subroot, master_package)

    write_file(makename(master_package, subroot), text, opts)
894553
def create_module(name, path):
    
    module = imp.new_module(name)
    module.__file__ = path
    execfile(path, module.__dict__)
    return module
271715
def create_module_file(package, module, opts):
    """"""
    if not opts.noheadings:
        text = format_heading(1, '%s module' % module)
    else:
        text = ''
    # text += format_heading(2, ':mod:`%s` Module' % module)
    text += format_directive(module, package)
    write_file(makename(package, module), text, opts)
4650
def to_zipfile(self, resource, zipfile):
        
        rpr_map = self.to_strings(resource)
        with ZipFile(zipfile, 'w') as zipf:
            for (mb_cls, rpr_string) in iteritems_(rpr_map):
                fn = get_collection_filename(mb_cls, self.__content_type)
                zipf.writestr(fn, rpr_string, compress_type=ZIP_DEFLATED)
1303522
public function createPluginZips()
	{
		$path = $this->current . "/plugins";

		// Get every plugin
		$hdl = opendir($path);

		while ($entry = readdir($hdl))
		{
			// Only folders
			$p = $path . "/" . $entry;

			if (substr($entry, 0, 1) == '.')
			{
				continue;
			}

			if (!is_file($p))
			{
				// Plugin type folder
				$type = $entry;

				$hdl2 = opendir($p);

				while ($plugin = readdir($hdl2))
				{
					if (substr($plugin, 0, 1) == '.')
					{
						continue;
					}

					// Only folders
					$p2 = $path . "/" . $type . "/" . $plugin;

					if (!is_file($p2))
					{
						$plg = "plg_" . $type . "_" . $plugin;

						$this->say("Packaging Plugin " . $plg);

						// Package file
						$zip = new \ZipArchive(JPATH_BASE . "/dist", \ZipArchive::CREATE);

						$zip->open(JPATH_BASE . '/dist/zips/' . $plg . '.zip', \ZipArchive::CREATE);

						// Process the files to zip
						$this->addFiles($zip, $p2);

						// Close the zip archive
						$zip->close();
					}
				}

				closedir($hdl2);
			}
		}

		closedir($hdl);
	}
844755
def create_module_file(txt, directory):
    """"""
    name = nonpresent_module_filename()
    path = os.path.join(directory, name)
    with open(path, 'w') as fh:
        fh.write(txt)
    return path
1183495
function createProject(zipFile) {
	return cocoonSDK.ProjectAPI.createFromZipUpload(zipFile)
	.catch((error) => {
		console.error("Project couldn't be created.");
		console.trace(error);
		throw error;
	});
}
822199
def from_zipfile(cls, path, filename, encoding, dialect, fields, converters):
        """"""

        stream = ZipReader(path, filename).readlines(encoding)
        return cls(stream, dialect, fields, converters)
881370
public function downloadPackage() {

		if (!is_dir($this->baseFolder)) {
			$app = Application::getInstance();
			$app->enqueueError('Plugin folder is missing');
			//$app->redirect($this->type . 's/default');
		}
		
		$this->createManifestFile();
		
		// removes old archives
		static::removeOldFiles();
		
		// useful paths
		$pathInfos	= pathInfo($this->baseFolder);
		$parentPath	= $pathInfos['dirname'];
		$dirName	= $pathInfos['basename'];
		
		// creates unique file name
		$filename	= Utilities::uniqueFilename($this->name . ucfirst($this->type) . '.zip', self::TEMP_FOLDER);
		$zipFile	= self::TEMP_FOLDER . '/' . $filename;
		
		// creates the ZIP archive
		$zip = new \ZipArchive();
		$zip->open($zipFile, \ZipArchive::CREATE);
		$zip->addEmptyDir($dirName);
		
		// recursive function to add all files in all sub-folders
		self::folderToZip($this->baseFolder, $zip, $parentPath);
		
		$zip->close();
		
		// add some log
		$app = Application::getInstance();
		$app->logEvent('Created ZIP file archive ' . $zipFile . ' for ' . $this->type . ' plugin');

		// lets user download the ZIP file
		header("Content-Type: application/zip");
		header("Content-Disposition: attachment; filename=$filename");
		header("Content-Length: " . filesize($zipFile));
		
		// sends the zip as download
		readfile($zipFile);
		exit();
		
	}
321020
def zip_built(outdir):
    """"""
    print("Zipping the built files!")

    config_file_dir = os.path.join(cwd, "config.py")
    if not os.path.exists(config_file_dir):
        sys.exit(
            "There dosen't seem to be a configuration file. Have you run the init command?")
    else:
        sys.path.insert(0, cwd)
        try:
            from config import website_name
        except:
            sys.exit(
                "Some of the configuration values could not be found! Maybe your config.py is too old. Run 'blended init' to fix.")

    # Remove the  build folder
    build_dir = os.path.join(cwd, outdir)
    zip_dir = os.path.join(cwd, website_name.replace(" ", "_") + "-build-" +
                           str(datetime.now().date()))
    if os.path.exists(build_dir):
        shutil.make_archive(zip_dir, 'zip', build_dir)
    else:
        print("The " + outdir +
              "/ folder could not be found! Have you run 'blended build' yet?")
957158
public function createLibraryZips()
	{
		$path = $this->current . "/libraries";

		// Get every module
		$hdl = opendir($path);

		while ($lib = readdir($hdl))
		{
			// Only folders
			$p = $path . "/" . $lib;

			if (substr($lib, 0, 1) == '.')
			{
				continue;
			}

			// Workaround for libraries without lib_
			if (substr($lib, 0, 3) != "lib")
			{
				$lib = 'lib_' . $lib;
			}

			if (!is_file($p))
			{
				$this->say("Packaging Library " . $lib);

				// Package file
				$zip = new \ZipArchive(JPATH_BASE . "/dist", \ZipArchive::CREATE);

				$zip->open(JPATH_BASE . '/dist/zips/' . $lib . '.zip', \ZipArchive::CREATE);

				$this->say("Library " . $p);

				// Process the files to zip
				$this->addFiles($zip, $p);

				// Close the zip archive
				$zip->close();
			}
		}

		closedir($hdl);
	}