Skip to content

Commit 061dfb1

Browse files
committed
Accurate, timeless headers
Per advice from the Linux Foundation, we can keep this short and don't need to list years. This also removes some stale information such as the authors file, and universal attribution to David. He wrote much of Hypothesis, but there are also large parts he's never touched!
1 parent c630d92 commit 061dfb1

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

tooling/src/hypothesistooling/__main__.py

+9-15
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import re
1919
import subprocess
2020
import sys
21-
from datetime import datetime
2221
from glob import glob
2322
from urllib.parse import urlparse
2423

@@ -142,24 +141,18 @@ def deploy():
142141
sys.exit(0)
143142

144143

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 = """
149146
# This file is part of Hypothesis, which may be found at
150147
# https://github.com/HypothesisWorks/hypothesis/
151148
#
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.
157151
#
158152
# This Source Code Form is subject to the terms of the Mozilla Public License,
159153
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
160154
# obtain one at https://mozilla.org/MPL/2.0/.
161-
#
162-
# END HEADER""".strip()
155+
""".strip()
163156

164157

165158
@task()
@@ -197,22 +190,23 @@ def warn(msg):
197190
config.from_file(os.path.join(hp.BASE_DIR, ".coveragerc"), warn=warn, our_file=True)
198191
pattern = "|".join(l for l in config.exclude_list if "pragma" not in l)
199192
unused_pragma_pattern = re.compile(f"(({pattern}).*) # pragma: no (branch|cover)")
193+
last_header_line = HEADER.splitlines()[-1].rstrip()
200194

201195
for f in files_to_format:
202196
lines = []
203197
with open(f, encoding="utf-8") as o:
204198
shebang = None
205199
first = True
206-
header_done = False
200+
in_header = True
207201
for l in o.readlines():
208202
if first:
209203
first = False
210204
if l[:2] == "#!":
211205
shebang = l
212206
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
214209
lines = []
215-
header_done = True
216210
else:
217211
lines.append(unused_pragma_pattern.sub(r"\1", l))
218212
source = "".join(lines).strip()

0 commit comments

Comments
 (0)