From 2cc664298bbfb58abcbf6a9de7df33e4c5962185 Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Tue, 7 Aug 2012 21:22:32 +0000 Subject: [PATCH] New copyright boilerplate policy for presubmit: don't require the current year on all modified files, and don't require (c). BUG=140977 Review URL: https://chromiumcodereview.appspot.com/10824191 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@150417 0039d316-1c4b-4281-b951-d872f2087c98 --- presubmit_canned_checks.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 6b9383e91..046424bef 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -882,14 +882,23 @@ def PanProjectChecks(input_api, output_api, r'.+\.json$', )) project_name = project_name or 'Chromium' + + # Accept any year number from 2006 to the current year, or the special + # 2006-2008 string used on the oldest files. 2006-2008 is deprecated, but + # tolerate it until it's removed from all files. + current_year = int(input_api.time.strftime('%Y')) + allowed_years = (str(s) for s in reversed(xrange(2006, current_year + 1))) + years_re = '(' + '|'.join(allowed_years) + '|2006-2008)' + + # The (c) is deprecated, but tolerate it until it's removed from all files. license_header = license_header or ( - r'.*? Copyright \(c\) %(year)s The %(project)s Authors\. ' + r'.*? Copyright (\(c\) )?%(year)s The %(project)s Authors\. ' r'All rights reserved\.\n' r'.*? Use of this source code is governed by a BSD-style license that ' r'can be\n' r'.*? found in the LICENSE file\.(?: \*/)?\n' ) % { - 'year': input_api.time.strftime('%Y'), + 'year': years_re, 'project': project_name, }