|
18 | 18 | import re
|
19 | 19 | import subprocess
|
20 | 20 | import sys
|
21 |
| -from datetime import datetime |
22 | 21 | from glob import glob
|
23 | 22 | from urllib.parse import urlparse
|
24 | 23 |
|
@@ -142,24 +141,18 @@ def deploy():
|
142 | 141 | sys.exit(0)
|
143 | 142 |
|
144 | 143 |
|
145 |
| -CURRENT_YEAR = datetime.utcnow().year |
146 |
| - |
147 |
| - |
148 |
| -HEADER = f""" |
| 144 | +# See https://www.linuxfoundation.org/blog/copyright-notices-in-open-source-software-projects/ |
| 145 | +HEADER = """ |
149 | 146 | # This file is part of Hypothesis, which may be found at
|
150 | 147 | # https://github.com/HypothesisWorks/hypothesis/
|
151 | 148 | #
|
152 |
| -# Most of this work is copyright (C) 2013-{CURRENT_YEAR} David R. MacIver |
153 |
| -# (david@drmaciver.com), but it contains contributions by others. See |
154 |
| -# CONTRIBUTING.rst for a full list of people who may hold copyright, and |
155 |
| -# consult the git log if you need to determine who owns an individual |
156 |
| -# contribution. |
| 149 | +# Copyright the Hypothesis Authors. |
| 150 | +# Individual contributors are listed in AUTHORS.rst and the git log. |
157 | 151 | #
|
158 | 152 | # This Source Code Form is subject to the terms of the Mozilla Public License,
|
159 | 153 | # v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
160 | 154 | # obtain one at https://mozilla.org/MPL/2.0/.
|
161 |
| -# |
162 |
| -# END HEADER""".strip() |
| 155 | +""".strip() |
163 | 156 |
|
164 | 157 |
|
165 | 158 | @task()
|
@@ -197,22 +190,23 @@ def warn(msg):
|
197 | 190 | config.from_file(os.path.join(hp.BASE_DIR, ".coveragerc"), warn=warn, our_file=True)
|
198 | 191 | pattern = "|".join(l for l in config.exclude_list if "pragma" not in l)
|
199 | 192 | unused_pragma_pattern = re.compile(f"(({pattern}).*) # pragma: no (branch|cover)")
|
| 193 | + last_header_line = HEADER.splitlines()[-1].rstrip() |
200 | 194 |
|
201 | 195 | for f in files_to_format:
|
202 | 196 | lines = []
|
203 | 197 | with open(f, encoding="utf-8") as o:
|
204 | 198 | shebang = None
|
205 | 199 | first = True
|
206 |
| - header_done = False |
| 200 | + in_header = True |
207 | 201 | for l in o.readlines():
|
208 | 202 | if first:
|
209 | 203 | first = False
|
210 | 204 | if l[:2] == "#!":
|
211 | 205 | shebang = l
|
212 | 206 | continue
|
213 |
| - if "END HEADER" in l and not header_done: |
| 207 | + elif in_header and l.rstrip() == last_header_line: |
| 208 | + in_header = False |
214 | 209 | lines = []
|
215 |
| - header_done = True |
216 | 210 | else:
|
217 | 211 | lines.append(unused_pragma_pattern.sub(r"\1", l))
|
218 | 212 | source = "".join(lines).strip()
|
|
0 commit comments