DEPS: recipe_engine/json, recipe_engine/path, recipe_engine/platform, recipe_engine/raw_io, recipe_engine/step
PYTHON_VERSION_COMPATIBILITY: PY2+3
Provides steps to zip and unzip files.
— def directory(self, step_name, directory, output, comment=None):
Step to compress a single directory.
Args: step_name: display name of the step. directory: path to a directory to compress, it would become the root of an archive, i.e. |directory|/file.txt would be named ‘file.txt’ in the archive. output: path to a zip file to create. comment: the archive comment to set on the created ZIP file.
— def get_comment(self, step_name, zip_file):
Returns the archive comment from |zip_file|.
Args: step_name: display name of a step. zip_file: path to a zip file to read, should exist.
— def make_package(self, root, output):
Returns ZipPackage object that can be used to compress a set of files.
Usage: pkg = api.zip.make_package(root, output) pkg.add_file(root.join(‘file’)) pkg.add_directory(root.join(‘directory’)) yield pkg.zip(‘zipping step’)
Args: root: a directory that would become root of a package, all files added to an archive will have archive paths relative to this directory. output: path to a zip file to create.
Returns: ZipPackage object.
— def unzip(self, step_name, zip_file, output, quiet=False):
Step to uncompress |zip_file| into |output| directory.
Zip package will be unpacked to |output| so that root of an archive is in |output|, i.e. archive.zip/file.txt will become |output|/file.txt.
Step will FAIL if |output| already exists.
Args: step_name: display name of a step. zip_file: path to a zip file to uncompress, should exist. output: path to a directory to unpack to, it should NOT exist. quiet (bool): If True, print terse output instead of the name of each unzipped file.
— def update_package(self, root, output):
Returns ZipPackage object that can be used to update an existing package.
Usage: pkg = api.zip.update_package(root, output) pkg.add_file(root.join(‘file’)) pkg.add_directory(root.join(‘directory’)) yield pkg.zip(‘updating zip step’)
Args: root: the root directory for adding new files/dirs to the package; all files/dirs added to an archive will have archive paths relative to this directory. output: path to a zip file to update.
Returns: ZipPackage object.
PYTHON_VERSION_COMPATIBILITY: PY2
— def RunSteps(api):
DEPS: depot_tools/bot_update, depot_tools/gclient, depot_tools/gsutil, zip, recipe_engine/buildbucket, recipe_engine/context, recipe_engine/file, recipe_engine/nodejs, recipe_engine/path, recipe_engine/platform, recipe_engine/step
PYTHON_VERSION_COMPATIBILITY: PY3
— def RunSteps(api):
DEPS: zip, recipe_engine/context, recipe_engine/file, recipe_engine/path, recipe_engine/platform, recipe_engine/step
PYTHON_VERSION_COMPATIBILITY: PY2+3
— def RunSteps(api):