gdbcopyright.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. def copyright(tool, description):
  20. # Search the tool source itself for the correct copyright years.
  21. with open(tool, "r") as f:
  22. for line in f:
  23. if line.startswith("# Copyright (C) "):
  24. dateline = line[1:].strip()
  25. break
  26. return f"""/* *INDENT-OFF* */ /* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */
  27. /* vi:set ro: */
  28. /* {description}
  29. {dateline}
  30. This file is part of GDB.
  31. This program is free software; you can redistribute it and/or modify
  32. it under the terms of the GNU General Public License as published by
  33. the Free Software Foundation; either version 3 of the License, or
  34. (at your option) any later version.
  35. This program is distributed in the hope that it will be useful,
  36. but WITHOUT ANY WARRANTY; without even the implied warranty of
  37. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  38. GNU General Public License for more details.
  39. You should have received a copy of the GNU General Public License
  40. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  41. /* To regenerate this file, run:
  42. ./{tool}
  43. */
  44. """