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
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 7570e4f..6eaa408 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -14,6 +14,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'
@@ -25,7 +29,7 @@
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