""" Package and upload lambda. """ from __future__ import print_function import os.path import zipfile stages = ['dev', 'prod'] for stage in stages: zip_filename = 'lambda.{stage}.zip'.format(stage=stage) zip_pathname = os.path.join('lambda_builds', zip_filename) config_filename = os.path.join( 'lambda_src', 'config.{stage}.py'.format(stage=stage)) lambda_filename = os.path.join('lambda_src', 'contact_form.py') print('Creating', zip_pathname) fh = open(zip_pathname, 'wb') zh = zipfile.ZipFile(fh, mode='w') zh.write(config_filename, 'config.py') zh.write(lambda_filename, 'contact_form.py') zh.close() fh.close()