Skip to content

Commit e82b729

Browse files
committed
update: scripts/release-homebrew.sh
1 parent 000ee54 commit e82b729

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/release-homebrew.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ python3 - "$FORMULA_PATH" "$VERSION" "$SHA256" "$TARBALL_URL" <<'PY'
106106
import hashlib
107107
import sys
108108
import urllib.request
109+
import urllib.error
109110
import pathlib
110111
111112
formula_path = pathlib.Path(sys.argv[1])
@@ -130,8 +131,16 @@ if old_version is None:
130131
raise SystemExit("could not locate version line in formula")
131132
132133
def download_sha(url):
133-
with urllib.request.urlopen(url) as resp:
134-
data = resp.read()
134+
try:
135+
with urllib.request.urlopen(url) as resp:
136+
data = resp.read()
137+
except urllib.error.HTTPError as exc:
138+
raise SystemExit(
139+
f"failed to download {url} ({exc.code} {exc.reason}). "
140+
"The release asset may not be available yet; wait for the release workflow to finish."
141+
)
142+
except urllib.error.URLError as exc:
143+
raise SystemExit(f"failed to download {url}: {exc.reason}")
135144
return hashlib.sha256(data).hexdigest()
136145
137146
sha_cache = {source_url: source_sha}

0 commit comments

Comments
 (0)