diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..f964496 --- /dev/null +++ b/.mailmap @@ -0,0 +1,7 @@ +# git mailmap file for consolidating git commit names and email addresses +# For details, see: https://git-scm.com/docs/git-check-mailmap +# +# Format for replacing name and email based upon commit email: +# Proper Name +# +Andreas Maier diff --git a/AUTHORS.md b/AUTHORS.md index 04cae69..067d5b2 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -2,6 +2,5 @@ Sorted list of authors derived from git commit history: ``` -Andreas Maier Andreas Maier ``` diff --git a/Makefile b/Makefile index 928d7c8..6d76a9d 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,7 @@ dist_dependent_files := \ pyproject.toml \ LICENSE \ README.md \ + AUTHORS.md \ requirements.txt \ $(filter-out $(version_file), $(package_py_files)) \ @@ -255,6 +256,9 @@ ifeq (,$(package_version)) $(error Package version could not be determined) endif +.PHONY: _always +_always: + .PHONY: install install: $(done_dir)/install_$(pymn)_$(PACKAGE_LEVEL).done @echo "Makefile: $@ done." @@ -414,14 +418,23 @@ docker: _check_version $(done_dir)/docker_$(pymn)_$(PACKAGE_LEVEL).done @echo "Makefile: $@ done." .PHONY: authors -authors: _check_version - echo "# Authors of this project" >AUTHORS.md - echo "" >>AUTHORS.md - echo "Sorted list of authors derived from git commit history:" >>AUTHORS.md - echo '```' >>AUTHORS.md - git shortlog --summary --email | cut -f 2 | sort >>AUTHORS.md - echo '```' >>AUTHORS.md - @echo '$@ done.' +authors: AUTHORS.md + @echo "Makefile: $@ done." + +# Make sure the AUTHORS.md file is up to date but has the old date when it did +# not change to prevent redoing dependent targets. In GitHub Actions, the +# 'git shortlog' command does not return authors anymore since around 8/2024. +# This is tolerated by leaving the file unchanged. +AUTHORS.md: _always + echo "# Authors of this project" >AUTHORS.md.tmp + echo "" >>AUTHORS.md.tmp + echo "Sorted list of authors derived from git commit history:" >>AUTHORS.md.tmp + echo '```' >>AUTHORS.md.tmp + sh -c "git shortlog --summary --email | cut -f 2 | sort >log.tmp" + sh -c "cat log.tmp >>AUTHORS.md.tmp" + echo '```' >>AUTHORS.md.tmp + sh -c "if ! grep -q '[^[:space:]]' log.tmp; then echo 'Warning - git shortlog does not display any authors - leaving AUTHORS.md file unchanged'; else if ! diff -q AUTHORS.md.tmp AUTHORS.md; then echo 'Updating AUTHORS.md as follows:'; diff AUTHORS.md.tmp AUTHORS.md; mv AUTHORS.md.tmp AUTHORS.md; else echo 'AUTHORS.md was already up to date'; fi; fi" + sh -c "rm -f log.tmp AUTHORS.md.tmp" .PHONY: clean clean: diff --git a/changes/noissue.1.feature.rst b/changes/noissue.1.feature.rst new file mode 100644 index 0000000..c005c32 --- /dev/null +++ b/changes/noissue.1.feature.rst @@ -0,0 +1,3 @@ +Dev: Automatically update AUTHORS.md when building the distribution archives. +The update is tolerant when 'git shortlog' does not show any authors - it then +issues a warning and leaves the existing file unchanged.