blob: 126d641a1e802a570b451973e301fdbb69425e5a (
plain)
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
|
#!/usr/bin/env python
import hashlib
import json
import os
import sys
import tarfile
import urllib
sharename = '48rLGpU1'
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)
print "No cached copy found, running carton install..."
os.system('cpanm -q Carton')
os.system('carton install --deployment')
|