wheel.py 593 Bytes
Newer Older
rusty1s's avatar
windows  
rusty1s committed
1
2
3
4
5
import boto3

s3_resource = boto3.resource('s3')
bucket = s3_resource.Bucket(name="pytorch-scatter")
objects = bucket.objects.all()
rusty1s's avatar
rusty1s committed
6
wheels = sorted([obj.key[4:] for obj in objects if obj.key[-3:] == 'whl'])
rusty1s's avatar
windows  
rusty1s committed
7

rusty1s's avatar
rusty1s committed
8
content = '<!DOCTYPE html>\n<html>\n<body>\n{}\n</body>\n</html>'
rusty1s's avatar
windows  
rusty1s committed
9
url = 'https://pytorch-scatter.s3.eu-central-1.amazonaws.com/whl/{}.whl'
rusty1s's avatar
rusty1s committed
10
11
12
13
14
15
16
links = ['<a href="{}">{}</a><br/>'.format(url.format(w), w) for w in wheels]
content = content.format('\n'.join(links))

with open('index.html', 'w') as f:
    f.write(content)

bucket.Object('whl/index.html').upload_file(Filename='index.html')