Chromium Code Reviews| Index: tools/metrics/histograms/update_policies.py |
| diff --git a/tools/metrics/histograms/update_policies.py b/tools/metrics/histograms/update_policies.py |
| index 5cad317512b3916541dc3d4d34ea3e55ea00b37d..1311dd919bc9c1ced67a073874e333c1ad4fcd5f 100644 |
| --- a/tools/metrics/histograms/update_policies.py |
| +++ b/tools/metrics/histograms/update_policies.py |
| @@ -8,6 +8,7 @@ definitions read from policy_templates.json. |
| If the file was pretty-printed, the updated version is pretty-printed too. |
| """ |
| +import os |
| import re |
| import sys |
| @@ -15,12 +16,15 @@ from ast import literal_eval |
| from optparse import OptionParser |
| from xml.dom import minidom |
| -from diffutil import PromptUserToAcceptDiff |
| -from pretty_print import PrettyPrintNode |
| +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' |
| +POLICY_TEMPLATES_PATH =( |
|
Ilya Sherman
2014/02/22 07:07:37
nit: Please leave a space between the '=' and the
yao
2014/02/24 19:16:23
Done.
|
| + '../../../components/policy/resources/policy_templates.json') |
| ENUM_NAME = 'EnterprisePolicies' |
| class UserError(Exception): |
| @@ -118,8 +122,7 @@ def main(): |
| xml = f.read() |
| UpdateHistogramDefinitions(policy_templates, histograms_doc) |
| - |
| - new_xml = PrettyPrintNode(histograms_doc) |
| + new_xml = print_style.GetPrintStyle().PrettyPrintNode(histograms_doc) |
| if PromptUserToAcceptDiff(xml, new_xml, 'Is the updated version acceptable?'): |
| with open(HISTOGRAMS_PATH, 'wb') as f: |
| f.write(new_xml) |