diff options
author | jkummerow@chromium.org <jkummerow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 10:12:55 +0000 |
---|---|---|
committer | jkummerow@chromium.org <jkummerow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 10:12:55 +0000 |
commit | 989733702ea9ccd8d2aa2a8b5dc2238bcab43c87 (patch) | |
tree | 63df9c4cad8c7ce94afc864aa33cd920b7de1456 /chrome_frame | |
parent | 00122a4dd029043dc94d6d25c4cdd9d9b3d2f99e (diff) | |
download | chromium_src-989733702ea9ccd8d2aa2a8b5dc2238bcab43c87.zip chromium_src-989733702ea9ccd8d2aa2a8b5dc2238bcab43c87.tar.gz chromium_src-989733702ea9ccd8d2aa2a8b5dc2238bcab43c87.tar.bz2 |
Syntax checker for policy_templates.json
To make sure that all policy definitions match the expected format. The checker is called as a presubmit hook, and can also be invoked manually. Run it without any parameters (or with --help) to get usage information.
BUG=69527
TEST=manual: checker reports no errors for correct policy definitions, checker complains for malformed policy definitions, checker is invoked as presubmit hook when policy_templates.json has been changed
Review URL: http://codereview.chromium.org/6299001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/PRESUBMIT.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/chrome_frame/PRESUBMIT.py b/chrome_frame/PRESUBMIT.py index 11a7c80..c3836b8 100644 --- a/chrome_frame/PRESUBMIT.py +++ b/chrome_frame/PRESUBMIT.py @@ -1,8 +1,7 @@ -# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Copyright (c) 2011 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. -import os import sys @@ -10,12 +9,17 @@ def CheckChange(input_api, output_api, committing): # We need to change the path so that we can import ceee_presubmit # which lies at the root of the ceee folder. And we do it here so that # it doesn't pollute all the cases where we get imported yet not called. - sys.path.append(os.path.join(input_api.PresubmitLocalPath(), '../ceee')) - import ceee_presubmit - return ceee_presubmit.CheckChange(input_api, - output_api, - committing, - is_chrome_frame=True) + old_sys_path = sys.path + ceee_path = input_api.os_path.join(input_api.PresubmitLocalPath(), '../ceee') + try: + sys.path = [ceee_path] + sys.path + import ceee_presubmit + return ceee_presubmit.CheckChange(input_api, + output_api, + committing, + is_chrome_frame=True) + finally: + sys.path = old_sys_path def CheckChangeOnUpload(input_api, output_api): |