Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: PRESUBMIT.py

Issue 2995493002: [impl/memory] Enforce named tasks during txn. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | impl/memory/taskqueue.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 03ce71d7b457408448e17889600e4f7c19f4172e..f592bcc0d23073c0d33f28b26aa27a43989664eb 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -19,6 +19,7 @@ details on the presubmit API built into depot_tools.
"""
import os
+import re
import sys
@@ -58,21 +59,33 @@ def PreCommitGo(input_api, output_api, pcg_mode):
])
+COPYRIGHT_TEMPLATE = """
+Copyright YEARPATTERN The LUCI Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+""".strip()
+
def header(input_api):
"""Returns the expected license header regexp for this project."""
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 %(year)s The LUCI Authors\. '
- r'All rights reserved\.\n'
- r'.*? Use of this source code is governed under the Apache License, '
- r'Version 2\.0\n'
- r'.*? that can be found in the LICENSE file\.(?: \*/)?\n'
- ) % {
- 'year': years_re,
- }
- return license_header
+ lines = [
+ ('.*? ' + re.escape(line)) if line else '.*?'
+ for line in COPYRIGHT_TEMPLATE.splitlines()
+ ]
+ lines[0] = lines[0].replace('YEARPATTERN', years_re)
+ return '\n'.join(lines) + '(?: \*/)?\n'
def source_file_filter(input_api):
« no previous file with comments | « no previous file | impl/memory/taskqueue.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698