fix preflight
This commit is contained in:
@@ -209,23 +209,43 @@ class Preflight:
|
||||
return Step("version-consistency", not problems, detail, data=data)
|
||||
|
||||
def _duplicate_guard(self) -> Step:
|
||||
"""Fail only when this version has already been *released*.
|
||||
|
||||
A populated ``SDK/<version>/`` is the normal input to preflight (it is
|
||||
what gets verified), so it is reported, not blocked. What must not happen
|
||||
silently is re-releasing a version that is already out: that is detected
|
||||
offline through git tags and, opt-in, against PyPI.
|
||||
"""
|
||||
problems: list[str] = []
|
||||
lines: list[str] = []
|
||||
|
||||
existing = version_mod.sdk_wheels(self.repo_root, self.version)
|
||||
if existing:
|
||||
lines.append(
|
||||
f"SDK/{self.version}/ holds {len(existing)} staged wheel(s) to verify: "
|
||||
f"{[w.name for w in existing]}"
|
||||
)
|
||||
else:
|
||||
lines.append(
|
||||
f"SDK/{self.version}/ is empty; nothing is staged yet "
|
||||
"(build with `python build/run.py wheel-win` / `manylinux`)"
|
||||
)
|
||||
|
||||
tags = version_mod.git_tags(self.repo_root)
|
||||
tag_hits = version_mod.released_tags_for(self.version, tags)
|
||||
if tag_hits:
|
||||
message = f"git tag(s) {tag_hits} already mark {self.version} as released"
|
||||
if self.options.force:
|
||||
lines.append(
|
||||
f"SDK/{self.version}/ already holds {len(existing)} wheel(s); "
|
||||
"overwriting because --force was passed"
|
||||
)
|
||||
lines.append(message + " (accepted via --force)")
|
||||
else:
|
||||
problems.append(
|
||||
f"SDK/{self.version}/ already holds {len(existing)} wheel(s): "
|
||||
f"{[w.name for w in existing]}. Pass --force to rebuild over them."
|
||||
message + "; pass --force to re-verify or intentionally re-release"
|
||||
)
|
||||
else:
|
||||
lines.append(f"SDK/{self.version}/ is empty (no wheel has been staged yet)")
|
||||
lines.append(
|
||||
f"no local git tag marks {self.version} as released "
|
||||
f"({len(tags)} tag(s) checked in this repo and {version_mod.RELEASE_REPO_DIRNAME})"
|
||||
)
|
||||
|
||||
if self.options.check_pypi:
|
||||
versions, error = version_mod.pypi_released_versions()
|
||||
@@ -240,7 +260,7 @@ class Preflight:
|
||||
)
|
||||
else:
|
||||
lines.append(
|
||||
f"PyPI has no {self.version}; published versions: " + (", ".join(versions) or "none")
|
||||
f"PyPI has no {self.version}; published: " + (", ".join(versions) or "none")
|
||||
)
|
||||
else:
|
||||
lines.append("PyPI existence check skipped (pass --check-pypi to enable)")
|
||||
|
||||
Reference in New Issue
Block a user