From a1b19e1d10896f3ac2ce0b97c2bf24e0c1c4520f Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Fri, 30 Mar 2018 19:47:52 -0400 Subject: CI integration --- .ci/s3-download-release.py | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 .ci/s3-download-release.py (limited to '.ci/s3-download-release.py') diff --git a/.ci/s3-download-release.py b/.ci/s3-download-release.py new file mode 100755 index 0000000..223f7f1 --- /dev/null +++ b/.ci/s3-download-release.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 + + +import argparse +import os +import os.path +import sys +import urllib.request + +import tinys3 + + +def main(): + parser = argparse.ArgumentParser(description='S3 File Uploader') + parser.add_argument( + '--s3-bucket', + help=('S3 bucket name (defaults to $S3_UPLOAD_BUCKET)'), + default=os.environ.get('S3_UPLOAD_BUCKET')) + parser.add_argument( + '--s3-region', + help=('S3 region (defaults to $S3_UPLOAD_REGION)'), + default=os.environ.get('S3_UPLOAD_REGION')) + parser.add_argument( + '--s3-username', + help=('S3 username (defaults to $S3_UPLOAD_USERNAME)'), + default=os.environ.get('S3_UPLOAD_USERNAME')) + parser.add_argument( + '--s3-key', + help=('S3 access key (defaults to $S3_UPLOAD_ACCESSKEY)'), + default=os.environ.get('S3_UPLOAD_ACCESSKEY')) + parser.add_argument( + '--s3-secret', + help=('S3 secret (defaults to $S3_UPLOAD_SECRET)'), + default=os.environ.get('S3_UPLOAD_SECRET')) + parser.add_argument( + '--destdir', + help='Destination directory.') + parser.add_argument( + 'package', metavar='PACKAGE', + help='Package name and version to download.') + + args = parser.parse_args() + + if args.s3_region: + endpoint = 's3-{}.amazonaws.com'.format(args.s3_region.lower()) + else: + endpoint = 's3.amazonaws.com' + + conn = tinys3.Connection( + access_key=args.s3_key, + secret_key=args.s3_secret, + default_bucket=args.s3_bucket, + tls=True, + endpoint=endpoint, + ) + + files = [] + + for entry in conn.list(args.package): + files.append(entry['key']) + + destdir = args.destdir or os.getpwd() + + for file in files: + print('Downloading {}...'.format(file)) + url = 'https://{}/{}/{}'.format(endpoint, args.s3_bucket, file) + target = os.path.join(destdir, file) + urllib.request.urlretrieve(url, target) + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) -- cgit v1.2.3 d65d80732f&showmsg=1'>Expand)Author 2024-08-22gnu: txr: Update to 296....Guillaume Le Vaillant 2024-08-18gnu: clasp-cl: Don't clutter lib and share directories....Guillaume Le Vaillant 2024-08-18gnu: sbcl: Fix startup error on i686-linux....Dariqq 2024-08-18gnu: sbcl: Update to 2.4.7....Ashish SHUKLA 2024-08-15gnu: Add clasp-cl....Ashish SHUKLA 2024-08-15gnu: ccl: Update to 1.13....Ashish SHUKLA