Do not put the upload logic in make_zip

This commit is contained in:
Cheng Zhao 2016-08-01 21:03:55 +09:00
parent 8f75f10239
commit 079a7a1a1c
3 changed files with 29 additions and 25 deletions

11
script/merge-electron-checksums.py Normal file → Executable file
View file

@ -12,21 +12,23 @@ from lib.config import s3_config
from lib.util import boto_path_dirs
sys.path.extend(boto_path_dirs())
from boto.s3.connection import S3Connection
def main():
args = parse_args()
bucket_name, access_key, secret_key = s3_config()
s3 = S3Connection(access_key, secret_key)
bucket = s3.get_bucket(bucket_name)
if bucket is None:
print('S3 bucket "{}" does not exist!'.format(bucket_name), file=sys.stderr)
return 1
prefix = 'atom-shell/tmp/{0}/'.format(args.version)
shasums = [s3_object.get_contents_as_string().strip()
for s3_object in bucket.list('atom-shell/tmp/', delimiter='/')
if s3_object.key.endswith('.sha256sum') and
args.version in s3_object.key]
for s3_object in bucket.list(prefix, delimiter='/')
if s3_object.key.endswith('.sha256sum')]
print('\n'.join(shasums))
return 0
@ -37,5 +39,6 @@ def parse_args():
required=True)
return parser.parse_args()
if __name__ == '__main__':
sys.exit(main())