diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 7570e4f9b6..6eaa4083b8 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -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 diff --git a/tools/PRESUBMIT.py b/tools/PRESUBMIT.py index 5e2faaf0ab..61dffcc2d3 100644 --- a/tools/PRESUBMIT.py +++ b/tools/PRESUBMIT.py @@ -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