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

Unified Diff: tools/metrics/histograms/update_policies.py

Issue 1143323006: Histograms.xml python script housekeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bad_message
Patch Set: Small whitespace adjustment Created 5 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
Index: tools/metrics/histograms/update_policies.py
diff --git a/tools/metrics/histograms/update_policies.py b/tools/metrics/histograms/update_policies.py
index 79f524f690b97a526fb139a90d0fd5233679b797..ec09ebafb82ae3bf05e33622701de8c693bae3b3 100644
--- a/tools/metrics/histograms/update_policies.py
+++ b/tools/metrics/histograms/update_policies.py
@@ -16,15 +16,13 @@ from ast import literal_eval
from optparse import OptionParser
from xml.dom import minidom
-import print_style
+sys.path.append(os.path.join(os.path.dirname(__file__), '..')) # tools/metrics
+from common.diff_util import PromptUserToAcceptDiff
+from common import path_util
+from histograms import print_style
-# Import the metrics/common module.
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
-from diff_util import PromptUserToAcceptDiff
-
-HISTOGRAMS_PATH = 'histograms.xml'
-POLICY_TEMPLATES_PATH = (
- '../../../components/policy/resources/policy_templates.json')
+HISTOGRAMS_PATH = path_util.GetHistogramsFile()
+POLICY_TEMPLATES_PATH = 'components/policy/resources/policy_templates.json'
ENUM_NAME = 'EnterprisePolicies'
class UserError(Exception):
@@ -114,7 +112,7 @@ def main():
sys.stderr.write(__doc__)
sys.exit(1)
- with open(POLICY_TEMPLATES_PATH, 'rb') as f:
+ with open(path_util.GetInputFile(POLICY_TEMPLATES_PATH), 'rb') as f:
policy_templates = literal_eval(f.read())
with open(HISTOGRAMS_PATH, 'rb') as f:
histograms_doc = minidom.parse(f)

Powered by Google App Engine
This is Rietveld 408576698