Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion PyReconstruct/modules/gui/main/first_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,17 @@ def parse_changelog_section(text, version):
target = _normalize_version(version)
if not text or not target:
return None
# Match by parsed PEP 440 version so any equivalent spelling of the header
# lines up with the runtime version -- e.g. a [1.21.0-beta-1] header (which
# setuptools-scm bakes into the app as 1.21.0b1) matches a 1.21.0b1 runtime;
# fall back to a normalized string compare for non-version headers
# ([Unreleased]). Mirrors whats_new_content's matching.
target_v = _safe_version(target)
for section in parse_all_sections(text):
if _normalize_version(section["version"]).lower() == target.lower():
sv = section["version"]
if target_v is not None and _safe_version(sv) == target_v:
return section["body"] or None
if _normalize_version(sv).lower() == target.lower():
return section["body"] or None
return None

Expand Down
5 changes: 3 additions & 2 deletions scripts/prune_prereleases.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@

# Pre-release suffixes appended to the exact X.Y.Z:
# PEP 440 compact: a<N> / b<N> / rc<N>
# dashed semver: -alpha[.N] / -beta[.N] / -rc[.N]
PRERELEASE_SUFFIX = r"(?:(?:a|b|rc)\d+|-(?:alpha|beta|rc)(?:\.\d+)?)"
# dashed semver: -alpha / -beta / -rc, optionally followed by a number with
# either a '.' or '-' separator (-beta.2 or -beta-2).
PRERELEASE_SUFFIX = r"(?:(?:a|b|rc)\d+|-(?:alpha|beta|rc)(?:[-.]\d+)?)"


def select_superseded(stable_tag: str, tags: list[str]) -> list[str]:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_first_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ def test_parse_changelog_section_missing_returns_none():
assert F.parse_changelog_section(SAMPLE, "") is None


def test_parse_changelog_section_matches_beta_by_version():
# setuptools-scm bakes a v1.21.0-beta-1 tag into the app as 1.21.0b1, so the
# [1.21.0-beta-1] header must match a 1.21.0b1 runtime by PARSED version, not
# raw string; the reverse spelling matches too.
dashed = "## [1.21.0-beta-1] — 2026-07-07\n\n- Beta bullet.\n"
assert "Beta bullet." in F.parse_changelog_section(dashed, "1.21.0b1")
compact = "## [1.21.0b1] — 2026-07-07\n\n- Beta bullet.\n"
assert "Beta bullet." in F.parse_changelog_section(compact, "1.21.0-beta-1")


# ---- friendly dates ---------------------------------------------------------
def test_friendly_date_formats_iso_without_leading_zero():
assert F.friendly_date("2026-06-29") == "June 29, 2026"
Expand Down
6 changes: 5 additions & 1 deletion tests/test_prune_prereleases.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
_spec.loader.exec_module(prune)

# Every same-line pre-release form the repo has used or planned:
# PEP 440 compact (rcN / aN / bN) and dashed semver (-rc.N / -alpha.N / -beta.N).
# PEP 440 compact (rcN / aN / bN) and dashed semver (-rc.N / -alpha.N / -beta.N),
# including the hyphen-number spelling -beta-N (the fork's chosen beta scheme).
SUPERSEDED = [
"v1.21.0rc1",
"v1.21.0rc2",
"v1.21.0-rc.1",
"v1.21.0-alpha.1",
"v1.21.0-beta.2",
"v1.21.0-beta-1",
"v1.21.0-beta-3",
"v1.21.0a1",
"v1.21.0b2",
]
Expand All @@ -40,6 +43,7 @@
"v1.20.4",
"v1.20.4rc2",
"v1.22.0rc1",
"v1.22.0-beta-1",
"v1.21.10rc1",
]

Expand Down
Loading