After #34084, our copyright headers shouldn't need "managing"; so remove the Python script.
contrib: remove `copyright_header.py` #34119
pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:final_copyright_changes changing 3 files +1 −661-
fanquake commented at 4:51 PM on December 19, 2025: member
- DrahtBot added the label Scripts and tools on Dec 19, 2025
-
DrahtBot commented at 4:52 PM on December 19, 2025: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34119.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste <code><!--meta-tag:bot-skip--></code> into the comment that the bot should ignore.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
-
3e4765ee10
scripted-diff: [doc] Unify stale copyright headers
-BEGIN VERIFY SCRIPT- sed --in-place --regexp-extended \ 's;( 20[0-2][0-9])(-20[0-2][0-9])? The Bitcoin Core developers;\1-present The Bitcoin Core developers;g' \ $( git grep -l 'The Bitcoin Core developers' -- ':(exclude)COPYING' ':(exclude)src/ipc/libmultiprocess' ':(exclude)src/minisketch' ) -END VERIFY SCRIPT- -
contrib: remove copyright_header.py ba6315d2f6
- fanquake force-pushed on Dec 19, 2025
- DrahtBot added the label CI failed on Dec 19, 2025
-
l0rinc commented at 5:53 PM on December 19, 2025: contributor
Should we add copyrights to the sources that don't currently have any such header (see: #34084 (comment))?
- DrahtBot removed the label CI failed on Dec 19, 2025
-
fjahr commented at 9:01 PM on December 25, 2025: contributor
ACK ba6315d2f6fe550912ab2ba87f165329d9e2f834
Double-checked that no further references to the script anywhere else in the docs were missed with some grepping.
-
fanquake commented at 4:23 PM on December 27, 2025: member
Should we add
I think they've all been added.
chainparamseeds.hwill be added when the script is next run. - fanquake marked this as ready for review on Dec 27, 2025
- rkrux approved
-
janb84 commented at 11:42 AM on December 29, 2025: contributor
ACK ba6315d2f6fe550912ab2ba87f165329d9e2f834
PR removes script that manages copyright headers. Given that the new approach is to use
-presentor no range at all, make the script obsolete.NIT / suggestion: transform the script to be a linter so that the CI checks for a (correct) copyright:
<details><summary>lint-copyright.py</summary>
#!/usr/bin/env python3 # # Copyright (c) 2025-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Check that all source files have proper copyright headers. """ import re import sys import fnmatch from subprocess import check_output # Excludes for specific files EXCLUDE = [ # Autogenerated: 'src/qt/bitcoinstrings.cpp', 'src/chainparamsseeds.h', # Other external copyrights: 'src/test/fuzz/FuzzedDataProvider.h', 'src/tinyformat.h', 'src/bench/nanobench.h', 'contrib/devtools/clang-format-diff.py', # Python init files: '*__init__.py', # Devtools bitcoin-tidy example: 'contrib/devtools/bitcoin-tidy/example_nontrivial-threadlocal.cpp', # contrib files: 'contrib/devtools/check-deps.sh', 'contrib/macdeploy/gen-sdk.py', 'contrib/verify-binaries/test.py', ] EXCLUDE_DIRS = [ # git subtrees "src/crypto/ctaes/", "src/leveldb/", "src/minisketch/", "src/secp256k1/", "src/crc32c/", ] # File extensions to include INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.mm', '*.py', '*.sh', '*.bash-completion'] # Compile patterns EXCLUDE_COMPILED = re.compile('|'.join([fnmatch.translate(m) for m in EXCLUDE])) INCLUDE_COMPILED = re.compile('|'.join([fnmatch.translate(m) for m in INCLUDE])) # Generic copyright pattern (accepts any copyright holder) # Matches "Copyright" with optional "(c)", and optional year/year-range COPYRIGHT_COMPILED = re.compile(r'Copyright', re.IGNORECASE) def applies_to_file(filename: str) -> bool: for excluded_dir in EXCLUDE_DIRS: if filename.startswith(excluded_dir): return False return (EXCLUDE_COMPILED.match(filename) is None and INCLUDE_COMPILED.match(filename) is not None) def get_filenames_to_examine() -> list[str]: git_ls_cmd = ['git', 'ls-files', '--full-name'] all_files = check_output(git_ls_cmd, text=True).splitlines() return sorted([f for f in all_files if applies_to_file(f)]) def file_has_copyright(filename: str) -> bool: """ Check if file has a copyright header in the first 10 lines. """ try: with open(filename, 'r', encoding='utf-8') as f: # Read first 10 lines first_lines = ''.join(f.readline() for _ in range(10)) except (UnicodeDecodeError, IOError): # Skip binary files or files that can't be read return True return COPYRIGHT_COMPILED.search(first_lines) is not None def main(): exit_code = 0 files_to_examine = get_filenames_to_examine() missing_copyright = [] for filename in files_to_examine: if not file_has_copyright(filename): missing_copyright.append(filename) if missing_copyright: print(f"The following {len(missing_copyright)} file(s) have no copyright notice:") for filename in missing_copyright: print(f" {filename}") exit_code = 1 sys.exit(exit_code) if __name__ == '__main__': main()</details>
- glozow merged this on Dec 29, 2025
- glozow closed this on Dec 29, 2025
- fanquake deleted the branch on Dec 29, 2025