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: memberAfter #34084, our copyright headers shouldn’t need “managing”; so remove the Python script.
-
DrahtBot added the label Scripts and tools on Dec 19, 2025
-
DrahtBot commented at 4:52 pm on December 19, 2025: contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Code Coverage & Benchmarks
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34119.
Reviews
See the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.
-
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: contributorShould 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:
0#!/usr/bin/env python3 1# 2# Copyright (c) 2025-present The Bitcoin Core developers 3# Distributed under the MIT software license, see the accompanying 4# file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 6""" 7Check that all source files have proper copyright headers. 8""" 9 10import re 11import sys 12import fnmatch 13from subprocess import check_output 14 15# Excludes for specific files 16EXCLUDE = [ 17 # Autogenerated: 18 'src/qt/bitcoinstrings.cpp', 19 'src/chainparamsseeds.h', 20 # Other external copyrights: 21 'src/test/fuzz/FuzzedDataProvider.h', 22 'src/tinyformat.h', 23 'src/bench/nanobench.h', 24 'contrib/devtools/clang-format-diff.py', 25 # Python init files: 26 '*__init__.py', 27 # Devtools bitcoin-tidy example: 28 'contrib/devtools/bitcoin-tidy/example_nontrivial-threadlocal.cpp', 29 # contrib files: 30 'contrib/devtools/check-deps.sh', 31 'contrib/macdeploy/gen-sdk.py', 32 'contrib/verify-binaries/test.py', 33] 34 35EXCLUDE_DIRS = [ 36 # git subtrees 37 "src/crypto/ctaes/", 38 "src/leveldb/", 39 "src/minisketch/", 40 "src/secp256k1/", 41 "src/crc32c/", 42] 43 44# File extensions to include 45INCLUDE = ['*.h', '*.cpp', '*.cc', '*.c', '*.mm', '*.py', '*.sh', '*.bash-completion'] 46 47# Compile patterns 48EXCLUDE_COMPILED = re.compile('|'.join([fnmatch.translate(m) for m in EXCLUDE])) 49INCLUDE_COMPILED = re.compile('|'.join([fnmatch.translate(m) for m in INCLUDE])) 50 51# Generic copyright pattern (accepts any copyright holder) 52# Matches "Copyright" with optional "(c)", and optional year/year-range 53COPYRIGHT_COMPILED = re.compile(r'Copyright', re.IGNORECASE) 54 55 56def applies_to_file(filename: str) -> bool: 57 for excluded_dir in EXCLUDE_DIRS: 58 if filename.startswith(excluded_dir): 59 return False 60 return (EXCLUDE_COMPILED.match(filename) is None and 61 INCLUDE_COMPILED.match(filename) is not None) 62 63 64def get_filenames_to_examine() -> list[str]: 65 git_ls_cmd = ['git', 'ls-files', '--full-name'] 66 all_files = check_output(git_ls_cmd, text=True).splitlines() 67 return sorted([f for f in all_files if applies_to_file(f)]) 68 69 70def file_has_copyright(filename: str) -> bool: 71 """ 72 Check if file has a copyright header in the first 10 lines. 73 """ 74 try: 75 with open(filename, 'r', encoding='utf-8') as f: 76 # Read first 10 lines 77 first_lines = ''.join(f.readline() for _ in range(10)) 78 except (UnicodeDecodeError, IOError): 79 # Skip binary files or files that can't be read 80 return True 81 82 return COPYRIGHT_COMPILED.search(first_lines) is not None 83 84 85def main(): 86 exit_code = 0 87 files_to_examine = get_filenames_to_examine() 88 89 missing_copyright = [] 90 for filename in files_to_examine: 91 if not file_has_copyright(filename): 92 missing_copyright.append(filename) 93 94 if missing_copyright: 95 print(f"The following {len(missing_copyright)} file(s) have no copyright notice:") 96 for filename in missing_copyright: 97 print(f" {filename}") 98 exit_code = 1 99 100 sys.exit(exit_code) 101 102 103if __name__ == '__main__': 104 main() -
glozow merged this on Dec 29, 2025
-
glozow closed this on Dec 29, 2025
-
fanquake deleted the branch on Dec 29, 2025
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-11 06:13 UTC
More mirrored repositories can be found on mirror.b10c.me