aboutsummaryrefslogtreecommitdiffstats
path: root/.travis/install
diff options
context:
space:
mode:
Diffstat (limited to '.travis/install')
-rwxr-xr-x.travis/install28
1 files changed, 16 insertions, 12 deletions
diff --git a/.travis/install b/.travis/install
index 126d641a1..8514e801d 100755
--- a/.travis/install
+++ b/.travis/install
@@ -1,28 +1,32 @@
#!/usr/bin/env python
import hashlib
-import json
import os
import sys
import tarfile
-import urllib
-sharename = '48rLGpU1'
+import boto
+from boto.s3.key import Key
+from boto.exception import S3ResponseError
root = os.path.join(os.path.dirname(__file__), '..')
with open(os.path.join(root, 'cpanfile.snapshot')) as cpanfile:
hash = hashlib.md5(cpanfile.read()).hexdigest()
wanted_filename = 'fixmystreet-local-%s.tgz' % hash
-share = json.loads( urllib.urlopen( 'https://open.ge.tt/1/shares/%s' % sharename ).read() )
-for file in share['files']:
- if file['filename'] == wanted_filename and file['readystate'] == 'uploaded':
- print "Found cached copy of local, using..."
- urllib.urlretrieve('https://open.ge.tt/1/files/%s/%s/blob' % (sharename, file['fileid']), wanted_filename)
- if tarfile.is_tarfile(wanted_filename):
- tfile = tarfile.open(wanted_filename)
- tfile.extractall()
- sys.exit(0)
+conn = boto.connect_s3()
+bucket = conn.get_bucket('fixmystreet-bundle-cache')
+
+k = Key(bucket)
+k.key = wanted_filename
+try:
+ k.get_contents_to_filename(wanted_filename)
+ if tarfile.is_tarfile(wanted_filename):
+ tfile = tarfile.open(wanted_filename)
+ tfile.extractall()
+ sys.exit(0)
+except S3ResponseError:
+ os.remove(wanted_filename)
print "No cached copy found, running carton install..."
os.system('cpanm -q Carton')