docs: make release changelog commands portable to macOS - #853
Merged
Conversation
The two sed -i calls in the release and re-arm steps only work with GNU sed. BSD sed on macOS requires a suffix argument after -i, and the re-arm command also uses the GNU-only 0,/re/ address and \n in the replacement. Replace both with perl, which is preinstalled on macOS and Linux and behaves the same on both.
|
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Collaborator
Author
|
i debated between this and a justfile target to do it.. this was a smaller change but happy to consider alternatives if you have a preference |
edavidaja
approved these changes
Sep 10, 2026
Collaborator
|
I think a just target would be nice if you feel like it but if not, thank you! |
Collaborator
Author
|
I'll merge as is for now... if i need to come back to any of this, i can explore the just target. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
The release and re-arm steps in CONTRIBUTING.md use
sed -iin forms that only work with GNU sed. On macOS, the release step fails because BSD sed requires a suffix argument after-i, and the re-arm step has no BSD equivalent at all: it relies on the GNU-only0,/re/address range and on\nin the replacement text. Anyone releasing from a Mac has to translate the commands by hand.Type of Change
Approach
Replace both
sed -icalls with perl, which is preinstalled on macOS and on mainstream Linux distributions and behaves the same on both:perl -pi -e "s/^## Unreleased/## [$VERSION] - $(date +%Y-%m-%d)/" docs/CHANGELOG.mdperl -0777 -pi -e 's/^## \[/## Unreleased\n\n$&/m' docs/CHANGELOG.mdThe re-arm command slurps the file so
^with the/mflag matches the start of each line, and without/gonly the first## [heading gets the new## Unreleasedsection inserted above it.A one-line comment above the first command explains why it is perl rather than sed, so the change is not reverted later.
Alternatives considered:
sed -i.bakis portable for the release step but not the re-arm step; awk needs a temp file and a move; ajustrecipe backed by Python would be cleanest but is more than this doc fix needs.Automated Tests
None. This changes documentation only. Both commands were run by hand on macOS against a copy of
docs/CHANGELOG.mdand produced the expected result.Directions for Reviewers
On a Mac or Linux machine, copy
docs/CHANGELOG.mdsomewhere scratch and run the two commands from the diff against it, withVERSIONset to any value. The release command should rename## Unreleasedto a dated heading. The re-arm command should insert a blank-line-separated## Unreleasedsection above the topmost release heading, once.Checklist
rsconnect-python-tests-at-nightworkflow in Connect against this feature branch. (Not needed: no code change.)