Skip to content

Updating Copyright Year

Bill Sacks edited this page Feb 18, 2023 · 1 revision

At the start of each year, we need to update the copyright year in the copyright notices that appear in the header of each source code file. This involves doing a project-wide search-and-replace in the following repositories:

Nearly all instances can be found by searching for the string, "Copyright (c) 2002-2023" (where 2023 should be replaced by the previous year) and replacing it with a similar string with the end year updated to the current year.

One additional change is needed in the esmf repository: in the file src/addon/esmpy/doc/conf.py, the end year needs to be changed on the line starting with copyright = .

Various methods can be used to do the project-wide search-and-replace (command-line tools, editor functionality, etc.). For example, in 2023, Bill Sacks did this using Emacs, leveraging two of his favorite Emacs packages:

  • Using the Projectile package, running the command projectile-grep to do a project-wide search for "Copyright (c) 2002-2022"; this resulted in a grep buffer with matching lines.
  • Using the wgrep package, which allows editing files from a grep buffer, doing a search & replace of "Copyright (c) 2002-2022" with "Copyright (c) 2002-2023", then saving all files via the wgrep command wgrep-finish-edit.

As of February, 2023, the above instructions seem to capture all of the copyright notices that we want to change, but if you are concerned that you might have missed some files that have copyright notices in different formats, here are some ideas for grep commands you can use after doing the above replacements:

  • git grep -l '\- *2023' (where 2023 should be replaced by the previous year): finds any potential copyright notices that went up to the previous year but in a different format
  • git grep -i -l -e 'copyright.*20' --and --not -e 'Copyright (c) 2002-2023' (where 2023 should be replaced by the previous year): finds copyrights in a different format or ones that hadn't been updated correctly in the previous year. However, note that this turns up a lot of files in the main esmf repository that should not be changed, because they are either in eps files or in files from third-party packages with different copyright notices. So, if you do this search, you should just skim through the results with an eye towards files that should truly be updated; this may not be worth doing.