Commit 5f0ee8cb authored by Mohamed Heikal's avatar Mohamed Heikal Committed by Commit Bot

Tiger viewer upload script now downloads missing caspian files

If the caspian files are missing, the upload script will now download
them from the current latest deployment before uploading the new
version. This allows a chrome dev to upload a new version without
worrying about caspian if their changes are unrelated.

Change-Id: Ib0f79f760845b239215e2c8f8be3c964060fbeb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2551775Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Mohamed Heikal <mheikal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829632}
parent aa4b9e15
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
import argparse import argparse
import os import os
import requests
import shutil import shutil
import subprocess import subprocess
import sys import sys
...@@ -15,6 +16,12 @@ import uuid ...@@ -15,6 +16,12 @@ import uuid
FIREBASE_PROJECT = 'chrome-supersize' FIREBASE_PROJECT = 'chrome-supersize'
PROD_URL = 'https://chrome-supersize.firebaseapp.com/'
CASPIAN_FILES = [
'caspian_web.js',
'caspian_web.wasm',
'caspian_web.wasm.map',
]
PROD = 'prod' PROD = 'prod'
STAGING = 'staging' STAGING = 'staging'
...@@ -72,12 +79,22 @@ def _FirebaseDeploy(project_dir, deploy_mode=PROD): ...@@ -72,12 +79,22 @@ def _FirebaseDeploy(project_dir, deploy_mode=PROD):
cwd=project_dir) cwd=project_dir)
def _DownloadCaspianFiles(project_static_dir):
for f in CASPIAN_FILES:
response = requests.get(PROD_URL + f)
with open(os.path.join(project_static_dir, f), 'wb') as output:
output.write(response.content)
def _CopyStaticFiles(project_static_dir): def _CopyStaticFiles(project_static_dir):
"""Copy over static files from the static directory.""" """Copy over static files from the static directory."""
static_files = os.path.join(os.path.dirname(__file__), 'static') static_files = os.path.join(os.path.dirname(__file__), 'static')
if not os.path.exists(os.path.join(static_files, 'caspian_web.js')):
raise Exception('static/caspian_web.js is missing. See caspian/README.md')
shutil.copytree(static_files, project_static_dir) shutil.copytree(static_files, project_static_dir)
if not all(
os.path.exists(os.path.join(static_files, f)) for f in CASPIAN_FILES):
print('Some caspian files do not exist in ({}). Downloading *all* caspian '
'files from currently deployed instance.'.format(static_files))
_DownloadCaspianFiles(project_static_dir)
def _FillInAndCopyTemplates(project_static_dir): def _FillInAndCopyTemplates(project_static_dir):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment