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

Unified Diff: tools/buildbot_globals.py

Issue 291563008: make buildbot_globals.py read global_variables.json file from googlesource (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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: tools/buildbot_globals.py
diff --git a/tools/buildbot_globals.py b/tools/buildbot_globals.py
index 341cc362913f269ddcb785d1eba5c854d82cc325..1dd781906189f566ff8c53f9a147e0369963717b 100755
--- a/tools/buildbot_globals.py
+++ b/tools/buildbot_globals.py
@@ -12,6 +12,7 @@ Provides read access to buildbot's global_variables.json .
from contextlib import closing
import HTMLParser
+import base64
import json
import re
import svn
@@ -22,8 +23,9 @@ import urllib2
_global_vars = None
-GLOBAL_VARS_JSON_URL = ('http://skia-tree-status.appspot.com/repo-serving/'
- 'buildbot/site_config/global_variables.json')
+_GLOBAL_VARS_JSON_BASE64_URL = (
+ 'https://skia.googlesource.com/buildbot/+/master/'
+ 'site_config/global_variables.json?format=TEXT')
class GlobalVarsRetrievalError(Exception):
@@ -46,21 +48,9 @@ class NoSuchGlobalVariable(KeyError):
pass
-def retrieve_from_mirror(url):
- """Retrieve the given file from the Skia Buildbot repo mirror.
-
- Args:
- url: string; the URL of the file to retrieve.
- Returns:
- The contents of the file in the repository.
- """
- with closing(urllib2.urlopen(url)) as f:
- return f.read()
-
-
def Get(var_name):
"""Return the value associated with this name in global_variables.json.
-
+
Args:
var_name: string; the variable to look up.
Returns:
@@ -71,10 +61,11 @@ def Get(var_name):
global _global_vars
if not _global_vars:
try:
- global_vars_text = retrieve_from_mirror(GLOBAL_VARS_JSON_URL)
+ with closing(urllib2.urlopen(_GLOBAL_VARS_JSON_BASE64_URL)) as f:
+ global_vars_text = base64.b64decode(f.read())
except Exception as e:
raise GlobalVarsRetrievalError('Failed to retrieve %s:\n%s' %
- (GLOBAL_VARS_JSON_URL, str(e)))
+ (_GLOBAL_VARS_JSON_BASE64_URL, str(e)))
try:
_global_vars = json.loads(global_vars_text)
except ValueError as e:
« 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