From 651b44e0fccb5aed95d79997f90e35c69e3f7af7 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Tue, 14 Jul 2026 16:14:35 -0500 Subject: [PATCH] Update release script to be compatible with macOS BSD vs GNU `sed` problems: ``` sed -i '0,/^\$id: .*/s||$id: https://element-hq.github.io/synapse/schema/synapse/v1.157/synapse-config.schema.json|' schema/synapse-config.schema.yaml sed: 1: "schema/synapse-config.s ...": bad flag in substitute command: 'h' ``` --- scripts-dev/release.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts-dev/release.py b/scripts-dev/release.py index ea4fb0f142..af4a199277 100755 --- a/scripts-dev/release.py +++ b/scripts-dev/release.py @@ -260,7 +260,18 @@ def _prepare() -> None: schema_file = "schema/synapse-config.schema.yaml" major_minor_version = ".".join(new_version.split(".")[:2]) url = f"https://element-hq.github.io/synapse/schema/synapse/v{major_minor_version}/synapse-config.schema.json" - subprocess.check_output(["sed", "-i", f"0,/^\\$id: .*/s||$id: {url}|", schema_file]) + # Find/replace the `$id: ...` line in `schema/synapse-config.schema.yaml` with a new + # unique identifier for this release + # + # We use two `open(...)` blocks as it's easier to read/write then figure out the + # seek/truncate dance with one. + with open(schema_file) as f: + contents = f.read() + contents = re.sub( + r"^\$id: .*", f"$id: {url}", contents, count=1, flags=re.MULTILINE + ) + with open(schema_file, "w") as f: + f.write(contents) # Generate changelogs. generate_and_write_changelog(synapse_repo, current_version, new_version)