198 import sys
199 import tomllib
200▶ import urllib.error
201 import urllib.request
202
· · ·
219 if requested_version and normalize(requested_version) != normalize(version):
220 print(
221▶ f"::error::Requested release version {requested_version!r} does "
222 f"not match {pkg_name} pyproject.toml version {version!r}."
223 )
· · ·
233 with urllib.request.urlopen(url, timeout=10):
234 already_published = True
235▶ except urllib.error.HTTPError as err:
236 if err.code == 404:
237 already_published = False
· · ·
239 # Fail closed: an unexpected status means we can't verify.
240 print(
241▶ f"::error::PyPI returned HTTP {err.code} checking whether "
242 f"{pkg_name}=={version} exists; cannot verify, aborting."
243 )
· · ·
244 sys.exit(1)
245▶ except urllib.error.URLError as err:
246 # Fail closed: if PyPI is unreachable we must not assume the version
247 # is free, or we risk re-publishing an existing release.
+ 9 more matches in this file