Ryan S. Brown

Compress function zip file to save space/$$$

......@@ -98,7 +98,8 @@ class Function(object):
LOG.debug('_zip_lambda_dir: lambda_dir=%s', lambda_dir)
LOG.debug('zipfile_name=%s', zipfile_name)
relroot = os.path.abspath(lambda_dir)
with zipfile.ZipFile(zipfile_name, 'w') as zf:
with zipfile.ZipFile(zipfile_name, 'w',
compression=zipfile.ZIP_DEFLATED) as zf:
for root, dirs, files in os.walk(lambda_dir):
zf.write(root, os.path.relpath(root, relroot))
for filename in files:
......@@ -111,7 +112,8 @@ class Function(object):
def _zip_lambda_file(self, zipfile_name, lambda_file):
LOG.debug('_zip_lambda_file: lambda_file=%s', lambda_file)
LOG.debug('zipfile_name=%s', zipfile_name)
with zipfile.ZipFile(zipfile_name, 'w') as zf:
with zipfile.ZipFile(zipfile_name, 'w',
compression=zipfile.ZIP_DEFLATED) as zf:
zf.write(lambda_file)
def zip_lambda_function(self, zipfile_name, lambda_fn):
......