forked from getlantern/lantern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copylatestwrapper.py
executable file
·46 lines (37 loc) · 1.13 KB
/
copylatestwrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
import sys
import boto
from boto.s3.key import Key
if len(sys.argv) != 2:
sys.exit("Usage: origin net-installer prefix expected, as in 'zodsmxt3'")
newestprefix = str(sys.argv[1])
conn = boto.connect_s3()
b = conn.get_bucket('lantern-installers')
keys = b.list()
osx = newestprefix + '/lantern-net-installer_macos_0_0_1.dmg'
linux = newestprefix + '/lantern-net-installer_unix_0_0_1.sh'
win = newestprefix + '/lantern-net-installer_windows_0_0_1.exe'
print win
newestosx = Key(b)
newestosx.key = osx
newestwin = Key(b)
newestwin.key = win
newestlinux = Key(b)
newestlinux.key = linux
for key in keys:
#print key.name
if key.name.startswith(newestprefix):
print 'not copying from origin bucket ' + key.name
else:
print 'attempting to copy from '+osx+' to '+key.name
if key.name.endswith('dmg'):
src = newestosx
elif key.name.endswith('exe'):
src = newestwin
elif key.name.endswith('sh'):
src = newestlinux
else:
print 'bad name: '+key.name
continue
print 'Copying from '+src.key+' to '+key.name
src.copy('lantern-installers', key.name, preserve_acl=True)