Merge pull request #9 from ryansb/develop
Compress function zip file to save space/$$$
Showing
1 changed file
with
4 additions
and
2 deletions
... | @@ -98,7 +98,8 @@ class Function(object): | ... | @@ -98,7 +98,8 @@ class Function(object): |
98 | LOG.debug('_zip_lambda_dir: lambda_dir=%s', lambda_dir) | 98 | LOG.debug('_zip_lambda_dir: lambda_dir=%s', lambda_dir) |
99 | LOG.debug('zipfile_name=%s', zipfile_name) | 99 | LOG.debug('zipfile_name=%s', zipfile_name) |
100 | relroot = os.path.abspath(lambda_dir) | 100 | relroot = os.path.abspath(lambda_dir) |
101 | - with zipfile.ZipFile(zipfile_name, 'w') as zf: | 101 | + with zipfile.ZipFile(zipfile_name, 'w', |
102 | + compression=zipfile.ZIP_DEFLATED) as zf: | ||
102 | for root, dirs, files in os.walk(lambda_dir): | 103 | for root, dirs, files in os.walk(lambda_dir): |
103 | zf.write(root, os.path.relpath(root, relroot)) | 104 | zf.write(root, os.path.relpath(root, relroot)) |
104 | for filename in files: | 105 | for filename in files: |
... | @@ -111,7 +112,8 @@ class Function(object): | ... | @@ -111,7 +112,8 @@ class Function(object): |
111 | def _zip_lambda_file(self, zipfile_name, lambda_file): | 112 | def _zip_lambda_file(self, zipfile_name, lambda_file): |
112 | LOG.debug('_zip_lambda_file: lambda_file=%s', lambda_file) | 113 | LOG.debug('_zip_lambda_file: lambda_file=%s', lambda_file) |
113 | LOG.debug('zipfile_name=%s', zipfile_name) | 114 | LOG.debug('zipfile_name=%s', zipfile_name) |
114 | - with zipfile.ZipFile(zipfile_name, 'w') as zf: | 115 | + with zipfile.ZipFile(zipfile_name, 'w', |
116 | + compression=zipfile.ZIP_DEFLATED) as zf: | ||
115 | zf.write(lambda_file) | 117 | zf.write(lambda_file) |
116 | 118 | ||
117 | def zip_lambda_function(self, zipfile_name, lambda_fn): | 119 | def zip_lambda_function(self, zipfile_name, lambda_fn): | ... | ... |
-
Please register or login to post a comment