MCPcopy
hub / github.com/aws/aws-cli / zip_directory

Function zip_directory

awscli/customizations/gamelift/uploadbuild.py:153–162  ·  view source on GitHub ↗
(zipfile_name, source_root)

Source from the content-addressed store, hash-verified

151
152
153def zip_directory(zipfile_name, source_root):
154 source_root = os.path.abspath(source_root)
155 with open(zipfile_name, 'wb') as f:
156 zip_file = zipfile.ZipFile(f, 'w', zipfile.ZIP_DEFLATED, True)
157 with contextlib.closing(zip_file) as zf:
158 for root, dirs, files in os.walk(source_root):
159 for filename in files:
160 full_path = os.path.join(root, filename)
161 relative_path = os.path.relpath(full_path, source_root)
162 zf.write(full_path, relative_path)
163
164
165def validate_directory(source_root):

Callers 4

test_single_fileMethod · 0.90
test_multiple_filesMethod · 0.90
test_nested_fileMethod · 0.90
_run_mainMethod · 0.85

Calls 2

walkMethod · 0.45
writeMethod · 0.45

Tested by 3

test_single_fileMethod · 0.72
test_multiple_filesMethod · 0.72
test_nested_fileMethod · 0.72