Lines Matching +full:output +full:- +full:files
2 # Use of this source code is governed by a BSD-style license that can be
4 """Helper functions for dealing with .zip files."""
26 padding_needed = (alignment - (pos % alignment)) % alignment
50 """Adds a file to the given ZipFile with a hard-coded modified time.
82 f'Non-canonical zip_path: {zip_path} vs: {posixpath.normpath(zip_path)}')
103 # growing files, disable compression at an arbitrary cut off point.
116 output, argument
122 """Creates a zip file from a list of files.
126 output: Path, fileobj, or ZipFile instance to add files to.
130 timestamp: Unix timestamp to use for files in the archive.
139 # Zip files always use / as path separator.
148 out_zip = output
149 if not isinstance(output, zipfile.ZipFile):
150 out_zip = zipfile.ZipFile(output, 'w')
162 if output is not out_zip:
166 def zip_directory(output, base_dir, **kwargs): argument
167 """Zips all files in the given directory."""
169 for root, _, files in os.walk(base_dir):
170 for f in files:
173 add_files_to_zip(inputs, output, base_dir=base_dir, **kwargs)
176 def merge_zips(output, input_zips, path_transform=None, compress=None): argument
177 """Combines all files from |input_zips| into |output|.
180 output: Path, fileobj, or ZipFile instance to add files to.
181 input_zips: Iterable of paths to zip files to merge.
187 if isinstance(output, zipfile.ZipFile):
188 out_zip = output
189 out_filename = output.filename
191 assert isinstance(output, str), 'Was: ' + repr(output)
192 out_zip = zipfile.ZipFile(output, 'w')
193 out_filename = output
195 # Include paths in the existing zip here to avoid adding duplicate files.
203 if info.filename[-1] == '/':
237 if output is not out_zip: