[Build] Propagate vLLM version to Rust binaries (#52593)

Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Co-authored-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Bugen Zhao
2026-08-17 23:37:37 -07:00
committed by GitHub
co-authored by Nick Hill Andreas Karatzas
parent b0e9cff5e7
commit c89d692cb5
24 changed files with 135 additions and 39 deletions
+16
View File
@@ -11,8 +11,23 @@ from pathlib import Path
from setuptools import setup
from setuptools_rust import Binding, RustExtension
from setuptools_scm import get_version
ROOT_DIR = Path(__file__).resolve().parents[1]
VLLM_RS_BUILD_VERSION = "VLLM_RS_BUILD_VERSION"
def prepare_build_environment() -> str | None:
"""Set the device-independent vLLM source version for Rust artifacts."""
version = os.getenv(VLLM_RS_BUILD_VERSION) or None
if version is None:
try:
version = get_version(root=ROOT_DIR)
except LookupError:
return None
os.environ[VLLM_RS_BUILD_VERSION] = version
return version
def rust_extensions(*, optional: bool = False) -> list[RustExtension]:
@@ -61,6 +76,7 @@ def build_binary(build_rust_args: list[str]) -> None:
def main() -> None:
prepare_build_environment()
build_binary(sys.argv[1:])