This is an automated email from the ASF dual-hosted git repository.

MasterJH5574 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new a8ba3a30 fix(version): Keep source patch ahead of post releases (#698)
a8ba3a30 is described below

commit a8ba3a3075cabc6e1105cc32c427ed4bd10c18c3
Author: Tianqi Chen <[email protected]>
AuthorDate: Sun Aug 2 23:08:27 2026 +0800

    fix(version): Keep source patch ahead of post releases (#698)
    
    - Preserve setuptools-scm post-release versions as the Python package
    identity.
    - Derive checked C++ and Rust source versions from the already-advanced
    patch after a post release.
    - Document why setuptools-scm's default scheme remains on the
    post-release line instead of advancing the patch.
---
 tests/lint/check_version.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/lint/check_version.py b/tests/lint/check_version.py
index f7c19e06..dcce6228 100644
--- a/tests/lint/check_version.py
+++ b/tests/lint/check_version.py
@@ -46,6 +46,9 @@ def _version_info() -> dict[str, Any]:
     """Return project version information using setuptools_scm."""
     version = setuptools_scm.get_version()
     v = packaging_version(version)
+    # After v0.1.13-post0, setuptools-scm derives 0.1.13.post1.devN rather than
+    # 0.1.14.devN; source checks still target the already-bumped patch 0.1.14.
+    source_release = (v.major, v.minor, v.micro + int(v.is_postrelease))
 
     return {
         "full": version,
@@ -62,6 +65,7 @@ def _version_info() -> dict[str, Any]:
         "is_devrelease": v.is_devrelease,
         "base_version": v.base_version,
         "public": v.public,
+        "source_release": source_release,
     }
 
 
@@ -106,11 +110,7 @@ def _check_cpp(version_info: dict) -> list[str]:
         errors.append(f"[C++] {c_api_path}: No version macros found: {major=}, 
{minor=}, {patch=}.")
         return errors
 
-    exp_major, exp_minor, exp_patch = (
-        version_info["major"],
-        version_info["minor"],
-        version_info["micro"],
-    )
+    exp_major, exp_minor, exp_patch = version_info["source_release"]
     if (major, minor, patch) != (exp_major, exp_minor, exp_patch):
         errors.append(
             f"[C++] {c_api_path}: Macro version mismatch: found 
{major}.{minor}.{patch}, "
@@ -143,7 +143,7 @@ def _check_rust(version_info: dict) -> list[str]:
         )
 
     # 2) Optionally enforce compatibility with Python version
-    base = version_info["base_version"]
+    base = ".".join(str(part) for part in version_info["source_release"])
     allowed: set[str] = {base}
     pre = _map_pep440_pre_to_semver(version_info.get("pre"))
     if pre:

Reply via email to