Updates the PRESUBMIT.py to allow years from 2011 to the current year.

Since Chromium has moved to this policy, we should too.
Code is copied from /depot_tools/presubmit_canned_checks.py but modified for our purpose.

BUG=
TEST=Tested git cl presubmit with a modified .cc file with the 2011 header and one with the 2012.

Review URL: https://webrtc-codereview.appspot.com/770005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2691 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org 2012-08-31 07:07:11 +00:00
parent 3baa8a2102
commit 6307dbf468
2 changed files with 10 additions and 2 deletions

View File

@ -14,6 +14,10 @@ LINT_FOLDERS = ['src/video_engine']
def _LicenseHeader(input_api):
"""Returns the license header regexp."""
# Accept any year number from 2011 to the current year
current_year = int(input_api.time.strftime('%Y'))
allowed_years = (str(s) for s in reversed(xrange(2011, current_year + 1)))
years_re = '(' + '|'.join(allowed_years) + ')'
license_header = (
r'.*? Copyright \(c\) %(year)s The WebRTC project authors\. '
r'All Rights Reserved\.\n'
@ -25,7 +29,7 @@ def _LicenseHeader(input_api):
r'.*? in the file PATENTS\. All contributing project authors may\n'
r'.*? be found in the AUTHORS file in the root of the source tree\.\n'
) % {
'year': input_api.time.strftime('%Y'),
'year': years_re,
}
return license_header

View File

@ -8,6 +8,10 @@
def _LicenseHeader(input_api):
"""Returns the license header regexp."""
# Accept any year number from 2011 to the current year
current_year = int(input_api.time.strftime('%Y'))
allowed_years = (str(s) for s in reversed(xrange(2011, current_year + 1)))
years_re = '(' + '|'.join(allowed_years) + ')'
license_header = (
r'.*? Copyright \(c\) %(year)s The WebRTC project authors\. '
r'All Rights Reserved\.\n'
@ -19,7 +23,7 @@ def _LicenseHeader(input_api):
r'.*? in the file PATENTS\. All contributing project authors may\n'
r'.*? be found in the AUTHORS file in the root of the source tree\.\n'
) % {
'year': input_api.time.strftime('%Y'),
'year': years_re,
}
return license_header