Beispiel #1
0
def main():
    p = argparse.ArgumentParser(prog=__prog__, version=__version__)
    p.add_argument('--bucket', required=True, help='S3 bucket')
    p.add_argument('--secret', help='S3 secret')
    p.add_argument('--region',
                   choices=[
                       'APNortheast', 'APSoutheast', 'APSoutheast2', 'DEFAULT',
                       'EU', 'EUCentral1', 'SAEast', 'USWest', 'USWest2'
                   ],
                   help='S3 Region')
    p.add_argument('--no-wheel',
                   dest='wheel',
                   action='store_false',
                   help='Skip wheel distribution')
    args = p.parse_args()

    package = Package.create(args.wheel)
    storage = S3Storage(args.bucket, args.secret, args.region)

    index = storage.get_index(package)
    index.packages.discard(package)
    index.packages.add(package)

    storage.put_package(package)
    storage.put_index(package, index)
Beispiel #2
0
def create_and_upload_package(args):
    package = Package.create(args.wheel)
    storage = S3Storage(args.bucket, args.secret, args.region, args.bare)

    index = storage.get_index(package)
    index.add_package(package, args.force)

    storage.put_package(package)
    storage.put_index(package, index)
Beispiel #3
0
def test_secret():
    storage = S3Storage('appstrakt-pypi', 'secret')
    assert 'secret' in storage.url
Beispiel #4
0
def test_secret_in_s3_key(secret):
    storage = S3Storage('appstrakt-pypi', secret)
    package = Package('test-0.1.0', [])
    assert secret in storage._object(package, 'index.html').key
Beispiel #5
0
def test_private_s3_key(private):
    storage = S3Storage('appstrakt-pypi', private=private)
    assert storage.acl == 'private'
Beispiel #6
0
def test_secret_in_s3_key(secret):
    storage = S3Storage("appstrakt-pypi", secret)
    package = Package("test-0.1.0", [])
    assert secret in storage._object(package, "index.html").key
    assert storage.acl == "public-read"
Beispiel #7
0
def test_private_s3_key(private):
    storage = S3Storage("appstrakt-pypi", private=private)
    assert storage.acl == "private"