Move copyright code from gdbarch.py to new file
[binutils-gdb.git] / gdb / gdbcopyright.py
1 # Copyright constant for Python code to use.
2 #
3 # Copyright (C) 2022 Free Software Foundation, Inc.
4 #
5 # This file is part of GDB.
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 def copyright(tool, description):
21 # Search the tool source itself for the correct copyright years.
22 with open(tool, 'r') as f:
23 for line in f:
24 if line.startswith('# Copyright (C) '):
25 dateline = line[1:].strip()
26 break
27 return f"""/* *INDENT-OFF* */ /* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */
28 /* vi:set ro: */
29
30 /* {description}
31
32 {dateline}
33
34 This file is part of GDB.
35
36 This program is free software; you can redistribute it and/or modify
37 it under the terms of the GNU General Public License as published by
38 the Free Software Foundation; either version 3 of the License, or
39 (at your option) any later version.
40
41 This program is distributed in the hope that it will be useful,
42 but WITHOUT ANY WARRANTY; without even the implied warranty of
43 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 GNU General Public License for more details.
45
46 You should have received a copy of the GNU General Public License
47 along with this program. If not, see <http://www.gnu.org/licenses/>. */
48
49 /* To regenerate this file, run:
50 ./{tool}
51 */
52 """