Chromium Code Reviews| Index: scripts/slave/recipe_modules/zip/resources/unzip.py |
| diff --git a/scripts/slave/recipe_modules/zip/resources/unzip.py b/scripts/slave/recipe_modules/zip/resources/unzip.py |
| index 0d1ae391f205cb6e8b1355df4c59e128f26d968a..a0441c14bfabeaa5c7c5233c22339be521ca204f 100644 |
| --- a/scripts/slave/recipe_modules/zip/resources/unzip.py |
| +++ b/scripts/slave/recipe_modules/zip/resources/unzip.py |
| @@ -14,7 +14,7 @@ import sys |
| import zipfile |
| -def unzip_with_subprocess(zip_file, output): |
| +def unzip_with_subprocess(zip_file, output, quiet): |
| """Unzips an archive using 'zip' utility. |
| Works only on Linux and Mac, uses system 'zip' program. |
| @@ -22,12 +22,19 @@ def unzip_with_subprocess(zip_file, output): |
| Args: |
| zip_file: absolute path to an archive to unzip. |
| output: existing directory to unzip to. |
| + quiet (bool): If True, instruct the subprocess to unzip with |
| + minimal output. |
| Returns: |
| Exit code (0 on success). |
| """ |
| + args = ['unzip'] |
| + if quiet: |
| + args += ['-q'] |
| + args += [zip_file] |
| + |
| return subprocess.call( |
| - args=['unzip', zip_file], |
| + args=args, |
| cwd=output) |
| @@ -55,6 +62,7 @@ def main(): |
| data = json.load(sys.stdin) |
| output = data['output'] |
| zip_file = data['zip_file'] |
| + quiet = data.get('quiet', False) |
|
iannucci
2016/09/30 21:05:21
this script will only ever be invoked by recipes.
dnj
2016/09/30 22:54:54
Done.
|
| # Archive path should exist and be an absolute path to a file. |
| assert os.path.exists(zip_file), zip_file |
| @@ -73,7 +81,7 @@ def main(): |
| exit_code = unzip_with_python(zip_file, output) |
| else: |
| # On mac and linux 'unzip' utility handles symlink and file modes. |
| - exit_code = unzip_with_subprocess(zip_file, output) |
| + exit_code = unzip_with_subprocess(zip_file, output, quiet) |
| finally: |
| # On non-zero exit code or on unexpected exception, clean up. |
| if exit_code: |