Skip to content

Commit 9f7ee3b

Browse files
committed
Merge branch 'develop'
2 parents 5040f51 + 91336ff commit 9f7ee3b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

benchbot_addons/manager.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ def load_yaml_list(filenames_list):
187187
def local_addon_path():
188188
return addon_path(*LOCAL_NAME.split('/'))
189189

190+
def google_wget_str(gid):
191+
str = 'wget --load-cookies /tmp/cookies.txt '+\
192+
'"https://docs.google.com/uc?export=download&confirm='+\
193+
'$(wget --quiet --save-cookies /tmp/cookies.txt '+\
194+
'--keep-session-cookies --no-check-certificate '+\
195+
'\'https://docs.google.com/uc?export=download&id=%s\'' % gid +\
196+
' -O- | sed -rn \'s/.*confirm=([0-9: A-Za-z_]+)'+\
197+
'.*/\1\n/p\')&id=%s" -O .tmp.zip && rm -rf ' % gid +\
198+
'/tmp/cookies.txt'
199+
return str
200+
190201

191202
def install_addon(name):
192203
url, repo_user, repo_name, name = _parse_name(name)
@@ -246,7 +257,14 @@ def install_addon(name):
246257
'remote_target' not in state[name] or
247258
state[name]['remote_target'] != target):
248259
print("\tRemote content is new. Fetching ...")
249-
if (run('wget "%s" -O ".tmp.zip"' % remote, **{
260+
# Hacky google drive download check and command
261+
# Should find better long-term storage after CloudStor
262+
if 'google' in remote:
263+
gid = re.search('/d/(.*)/view', remote).group(1)
264+
wget_str = google_wget_str(gid)
265+
else:
266+
wget_str ='wget "%s" -O ".tmp.zip"' % remote
267+
if (run(wget_str, **{
250268
**cmd_args, 'stdout': None,
251269
'stderr': None
252270
}).returncode != 0):

0 commit comments

Comments
 (0)