From c016047ed7bc5b634384f91c187d90d0bdcb87e9 Mon Sep 17 00:00:00 2001 From: Harry Mellor <19981378+hmellor@users.noreply.github.com> Date: Tue, 10 Jun 2025 05:36:54 +0100 Subject: [PATCH] Fix docs/mkdocs/hooks/remove_announcement.py (#19382) --- docs/mkdocs/hooks/remove_announcement.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/mkdocs/hooks/remove_announcement.py b/docs/mkdocs/hooks/remove_announcement.py index f67941d2a..1a84039ab 100644 --- a/docs/mkdocs/hooks/remove_announcement.py +++ b/docs/mkdocs/hooks/remove_announcement.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project import os +from pathlib import Path from typing import Literal @@ -8,10 +9,9 @@ def on_startup(command: Literal["build", "gh-deploy", "serve"], dirty: bool): # see https://docs.readthedocs.io/en/stable/reference/environment-variables.html # noqa if os.getenv('READTHEDOCS_VERSION_TYPE') == "tag": # remove the warning banner if the version is a tagged release - docs_dir = os.path.dirname(__file__) - announcement_path = os.path.join(docs_dir, - "mkdocs/overrides/main.html") + mkdocs_dir = Path(__file__).parent.parent + announcement_path = mkdocs_dir / "overrides/main.html" # The file might be removed already if the build is triggered multiple # times (readthedocs build both HTML and PDF versions separately) - if os.path.exists(announcement_path): + if announcement_path.exists(): os.remove(announcement_path)