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

Unified Diff: tools/buildbot_globals.py

Issue 873593005: Cleanup: Delete buildbot_globals.py script. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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
deleted file mode 100755
index e110ae9c6f330b6c3f440ad55c300b7583c9427b..0000000000000000000000000000000000000000
--- a/tools/buildbot_globals.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/python
-
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""
-Provides read access to buildbot's global_variables.json .
-"""
-
-
-import json
-import retrieve_from_googlesource
-import sys
-
-
-_global_vars = None
-
-
-SKIABOT_REPO = 'https://skia.googlesource.com/buildbot'
-_GLOBAL_VARS_PATH = 'site_config/global_variables.json'
-
-
-class GlobalVarsRetrievalError(Exception):
- """Exception which is raised when the global_variables.json file cannot be
- retrieved from the Skia buildbot repository."""
- pass
-
-
-class JsonDecodeError(Exception):
- """Exception which is raised when the global_variables.json file cannot be
- interpreted as JSON. This may be due to the file itself being incorrectly
- formatted or due to an incomplete or corrupted downloaded version of the file.
- """
- pass
-
-
-class NoSuchGlobalVariable(KeyError):
- """Exception which is raised when a given variable is not found in the
- global_variables.json file."""
- pass
-
-
-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:
- The value of the variable.
- Raises:
- NoSuchGlobalVariable if there is no variable with that name.
- """
- global _global_vars
- if not _global_vars:
- try:
- global_vars_text = retrieve_from_googlesource.get(SKIABOT_REPO,
- _GLOBAL_VARS_PATH)
- except Exception as e:
- raise GlobalVarsRetrievalError('Failed to retrieve %s from %s:\n%s' %
- (_GLOBAL_VARS_PATH, SKIABOT_REPO, str(e)))
- try:
- _global_vars = json.loads(global_vars_text)
- except ValueError as e:
- raise JsonDecodeError(e.message + '\n' + global_vars_text)
- try:
- return _global_vars[var_name]['value']
- except KeyError:
- raise NoSuchGlobalVariable(var_name)
-
-
-if __name__ == '__main__':
- print Get(sys.argv[1])
« 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