From 6307dbf4688b72233405ae72530d1182ac0159f4 Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Fri, 31 Aug 2012 07:07:11 +0000 Subject: [PATCH] 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 --- PRESUBMIT.py | 6 +++++- tools/PRESUBMIT.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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