73
73
]
74
74
75
75
76
- def CheckChangeOnUpload (input_api , output_api ):
77
- report = []
78
- report .extend (input_api .canned_checks .PanProjectChecks (
79
- input_api , output_api ))
80
- return report
81
-
82
-
83
- def CheckChangeOnCommit (input_api , output_api ):
84
- report = []
85
-
76
+ def _LicenseHeader (input_api ):
86
77
# Accept any year number from 2009 to the current year.
87
78
current_year = int (input_api .time .strftime ('%Y' ))
88
79
allowed_years = (str (s ) for s in reversed (xrange (2009 , current_year + 1 )))
80
+
89
81
years_re = '(' + '|' .join (allowed_years ) + ')'
90
82
91
83
# The (c) is deprecated, but tolerate it until it's removed from all files.
92
- license = (
84
+ return (
93
85
r'.*? Copyright (\(c\) )?%(year)s Google Inc\. All rights reserved\.\n'
94
86
r'.*? Use of this source code is governed by a BSD-style license that '
95
87
r'can be\n'
@@ -98,8 +90,18 @@ def CheckChangeOnCommit(input_api, output_api):
98
90
'year' : years_re ,
99
91
}
100
92
93
+ def CheckChangeOnUpload (input_api , output_api ):
94
+ report = []
95
+ report .extend (input_api .canned_checks .PanProjectChecks (
96
+ input_api , output_api , license_header = _LicenseHeader (input_api )))
97
+ return report
98
+
99
+
100
+ def CheckChangeOnCommit (input_api , output_api ):
101
+ report = []
102
+
101
103
report .extend (input_api .canned_checks .PanProjectChecks (
102
- input_api , output_api , license_header = license ))
104
+ input_api , output_api , license_header = _LicenseHeader ( input_api ) ))
103
105
report .extend (input_api .canned_checks .CheckTreeIsOpen (
104
106
input_api , output_api ,
105
107
'http://gyp-status.appspot.com/status' ,
0 commit comments