86 """Update the copyright header of the files in the given list.
88 We use gnulib's update-copyright script for that.
94 os.environ[
"UPDATE_COPYRIGHT_USE_INTERVALS"] =
"2"
97 update_cmd = [
"bash",
"gnulib/import/extra/update-copyright"]
98 update_cmd += update_list
100 p = subprocess.Popen(
102 stdout=subprocess.PIPE,
103 stderr=subprocess.STDOUT,
104 encoding=locale.getpreferredencoding(),
106 update_out = p.communicate()[0]
116 update_out = update_out.splitlines(keepends=
False)
117 warning_string =
": warning: copyright statement not found"
118 warning_len = len(warning_string)
120 for line
in update_out:
121 if line.endswith(warning_string):
122 filename = line[:-warning_len]
168def main(argv: List[str]) -> Optional[int]:
169 """The main subprogram."""
171 _ = parser.parse_args(argv)
172 root_dir = os.path.dirname(os.getcwd())
176 os.path.isdir(
"gdb")
and os.path.isfile(
"gnulib/import/extra/update-copyright")
178 sys.exit(
"Error: This script must be called from the gdb directory.")
185 if MULTIPLE_COPYRIGHT_HEADERS:
189 "REMINDER: Multiple copyright headers must be updated by hand:"
192 for filename
in MULTIPLE_COPYRIGHT_HEADERS:
198 "\033[31mREMINDER: The following files must be updated by hand." "\033[0m"
200 for filename
in BY_HAND: