Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1685)

Unified Diff: build/download_sdk_extras.py

Issue 934753007: Use CHROME_HEADLESS to check if download_sdk_extras.py is running on a bot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call gsutil.py with python for windows. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/download_sdk_extras.py
diff --git a/build/download_sdk_extras.py b/build/download_sdk_extras.py
index d38ee8651de5833924ea402c599ed80b10947583..45e71996f1f545f02b0a3c6dda6a5daa3450da8f 100755
--- a/build/download_sdk_extras.py
+++ b/build/download_sdk_extras.py
@@ -7,7 +7,8 @@
The script expects arguments that specify zips file in the google storage
bucket named: <dir in SDK extras>_<package name>_<version>.zip. The file will
-be extracted in the android_tools/sdk/extras directory.
+be extracted in the android_tools/sdk/extras directory on the test bots. This
+script will not do anything for developers.
"""
import json
@@ -17,11 +18,16 @@ import subprocess
import sys
import zipfile
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'android'))
+SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
+CHROME_SRC = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir))
+sys.path.insert(0, os.path.join(SCRIPT_DIR, 'android'))
+sys.path.insert(1, os.path.join(CHROME_SRC, 'tools'))
+
from pylib import constants
+import find_depot_tools
-GSUTIL_PATH = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
- os.pardir, os.pardir, os.pardir, os.pardir, 'depot_tools', 'gsutil.py')
+DEPOT_PATH = find_depot_tools.add_depot_tools_to_path()
+GSUTIL_PATH = os.path.join(DEPOT_PATH, 'gsutil.py')
SDK_EXTRAS_BUCKET = 'gs://chrome-sdk-extras'
SDK_EXTRAS_PATH = os.path.join(constants.ANDROID_SDK_ROOT, 'extras')
SDK_EXTRAS_JSON_FILE = os.path.join(os.path.dirname(__file__),
@@ -38,7 +44,7 @@ def clean_and_extract(dir_name, package_name, zip_file):
def main():
- if not os.path.exists(GSUTIL_PATH) or not os.path.exists(SDK_EXTRAS_PATH):
+ if not os.environ.get('CHROME_HEADLESS'):
# This is not a buildbot checkout.
return 0
# Update the android_sdk_extras.json file to update downloaded packages.
@@ -48,8 +54,8 @@ def main():
local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip'])
if not os.path.exists(local_zip):
package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip'])
- subprocess.check_call([GSUTIL_PATH, '--force-version', '4.7', 'cp',
- package_zip, local_zip])
+ subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7',
+ 'cp', package_zip, local_zip])
# Always clean dir and extract zip to ensure correct contents.
clean_and_extract(package['dir_name'], package['package'], package['zip'])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698