| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | import os |
| 4 | from pathlib import Path |
| 5 | from typing import Literal |
| 6 | |
| 7 | |
| 8 | def on_startup(command: Literal["build", "gh-deploy", "serve"], dirty: bool): |
| 9 | # see https://docs.readthedocs.io/en/stable/reference/environment-variables.html # noqa |
| 10 | if os.getenv("READTHEDOCS_VERSION_TYPE") == "tag": |
| 11 | # remove the warning banner if the version is a tagged release |
| 12 | mkdocs_dir = Path(__file__).parent.parent |
| 13 | announcement_path = mkdocs_dir / "overrides/main.html" |
| 14 | # The file might be removed already if the build is triggered multiple |
| 15 | # times (readthedocs build both HTML and PDF versions separately) |
| 16 | if announcement_path.exists(): |
| 17 | os.remove(announcement_path) |