Skip to content

fix: make reset-version portable across BSD and GNU sed#211

Merged
NaffanDroo merged 1 commit into
mainfrom
fix/reset-version-sed-portability
Jul 1, 2026
Merged

fix: make reset-version portable across BSD and GNU sed#211
NaffanDroo merged 1 commit into
mainfrom
fix/reset-version-sed-portability

Conversation

@NaffanDroo

Copy link
Copy Markdown
Collaborator

Summary

  • make reset-version was broken on macOS: BSD sed -i requires an explicit backup-suffix argument, so -i -E consumed -E as that suffix instead of enabling extended regex, leaving \1/\3 undefined ("\1 not defined in the RE").
  • Also fixes a stray space in the replacement that would have produced version = " 0.0.1" instead of version = "0.0.1".
  • Detects OS via uname -s and uses sed -i '' on Darwin, plain sed -i elsewhere, so the target now works on both BSD (macOS) and GNU (Linux) sed.

Test plan

  • Ran make reset-version on macOS — confirms pyproject.toml, src/tidy_python/__init__.py, and the test comment are correctly rewritten to 0.0.1
  • Reverted the test-run version bump, keeping only the Makefile fix

sed -i -E on macOS was broken because BSD sed's -i requires an
explicit backup-suffix argument, so it consumed -E as that suffix
instead of enabling extended regex. This left capture groups
undefined, causing "\1 not defined in the RE". Detect the OS via
uname and pick the correct in-place sed invocation, and drop a
stray space in the replacement that produced version = " 0.0.1".
@NaffanDroo
NaffanDroo enabled auto-merge (squash) July 1, 2026 18:44
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

☂️ Code Coverage

current status: ✅

Overall Coverage

Statements Covered Coverage Threshold Status
3 3 100% 0% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: ac94316 by action🐍

@NaffanDroo
NaffanDroo disabled auto-merge July 1, 2026 18:44
@NaffanDroo
NaffanDroo enabled auto-merge (squash) July 1, 2026 18:45
@NaffanDroo
NaffanDroo disabled auto-merge July 1, 2026 18:45
@NaffanDroo
NaffanDroo merged commit 096b2f6 into main Jul 1, 2026
6 checks passed
@NaffanDroo
NaffanDroo deleted the fix/reset-version-sed-portability branch July 1, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant