OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 """Presubmit script for Chromium theme resources. | |
6 | |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | |
8 for more details about the presubmit API built into gcl/git cl, and see | |
9 http://www.chromium.org/developers/web-development-style-guide for the rules | |
10 we're checking against here. | |
11 """ | |
12 | |
13 | |
oshima_google
2012/07/16 19:23:20
keep 1 new lines. same for other places.
flackr
2012/07/19 20:24:50
Just following the style guide. Not sure if that m
| |
14 def CheckChangeOnUpload(input_api, output_api): | |
15 return _CommonChecks(input_api, output_api) | |
16 | |
17 | |
18 def CheckChangeOnCommit(input_api, output_api): | |
19 return _CommonChecks(input_api, output_api) | |
20 | |
21 | |
22 def _CommonChecks(input_api, output_api): | |
23 """Checks common to both upload and commit.""" | |
24 results = [] | |
25 resources = input_api.os_path.join(input_api.PresubmitLocalPath(), | |
26 '../../../ui/resources') | |
27 | |
28 # List of paths with their associated scale factor. This is used to verify | |
29 # that the images modified in one are the correct scale of the other. | |
30 path_scales = [ | |
31 [[1, 'default_100_percent/'], [2, 'default_200_percent/']], | |
32 [[1, 'touch_100_percent/'], [2, 'touch_200_percent/']], | |
33 ] | |
oshima_google
2012/07/16 19:23:20
This must be same for all resources directory, so
oshima
2012/07/17 20:20:49
I guess this can be different for webui?
flackr
2012/07/19 20:24:50
If you think this makes more sense, I thought with
| |
34 | |
35 import sys | |
36 old_path = sys.path | |
37 | |
38 try: | |
39 sys.path = [resources] + old_path | |
40 from resource_check import resource_scale_factors | |
41 | |
42 for paths in path_scales: | |
43 results.extend(resource_scale_factors.ResourceScaleFactors( | |
44 input_api, output_api, paths).RunChecks()) | |
45 finally: | |
46 sys.path = old_path | |
47 | |
48 return results | |
OLD | NEW |