From 601e10637205bdb19ac70f1019b20aa7aad69e81 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 26 Oct 2026 17:36:06 -0700 Subject: [PATCH] Guard build_docs.sh against publishing pre-release doc trees Each subproject's build_docs.sh currently names the output subdir by importlib.metadata.version(), which on a pre-release checkout resolves to a PEP 440 .dev or +local string. When build_docs.sh is called without latest-only, that versioned subdir gets copied to latest/ and also published verbatim to gh-pages, where it accumulates as an orphan tree not reachable via nv-versions.json. Refuse that path explicitly in all three subprojects. Refs #3231. --- cuda_bindings_13/docs/build_docs.sh | 7 +++++++ cuda_core/docs/build_docs.sh | 7 +++++++ cuda_pathfinder/docs/build_docs.sh | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/cuda_bindings_13/docs/build_docs.sh b/cuda_bindings_13/docs/build_docs.sh index 199ababce60..3a536cb5f9a 100755 --- a/cuda_bindings_13/docs/build_docs.sh +++ b/cuda_bindings_13/docs/build_docs.sh @@ -51,6 +51,13 @@ cp source/_templates/main.html build/html/index.html # ensure that the latest docs is the one we built if [[ $LATEST_ONLY == "0" ]]; then + # Refuse to publish a versioned subdir for pre-release or local + # versions, which otherwise leak orphan trees onto gh-pages that + # are not reachable via nv-versions.json. See #3231. + if [[ "${SPHINX_CUDA_BINDINGS_VER}" == *.dev* || "${SPHINX_CUDA_BINDINGS_VER}" == *+* ]]; then + echo "refusing to publish versioned docs for pre-release version '${SPHINX_CUDA_BINDINGS_VER}'" >&2 + exit 1 + fi cp -r build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest else mv build/html/${SPHINX_CUDA_BINDINGS_VER} build/html/latest diff --git a/cuda_core/docs/build_docs.sh b/cuda_core/docs/build_docs.sh index 28ae6dd07fd..0c4a67bf1f0 100755 --- a/cuda_core/docs/build_docs.sh +++ b/cuda_core/docs/build_docs.sh @@ -46,6 +46,13 @@ cp source/_templates/main.html build/html/index.html # ensure that the latest docs is the one we built if [[ $LATEST_ONLY == "0" ]]; then + # Refuse to publish a versioned subdir for pre-release or local + # versions, which otherwise leak orphan trees onto gh-pages that + # are not reachable via nv-versions.json. See #3231. + if [[ "${SPHINX_CUDA_CORE_VER}" == *.dev* || "${SPHINX_CUDA_CORE_VER}" == *+* ]]; then + echo "refusing to publish versioned docs for pre-release version '${SPHINX_CUDA_CORE_VER}'" >&2 + exit 1 + fi cp -r build/html/${SPHINX_CUDA_CORE_VER} build/html/latest else mv build/html/${SPHINX_CUDA_CORE_VER} build/html/latest diff --git a/cuda_pathfinder/docs/build_docs.sh b/cuda_pathfinder/docs/build_docs.sh index 4720cd458f6..70385913e31 100755 --- a/cuda_pathfinder/docs/build_docs.sh +++ b/cuda_pathfinder/docs/build_docs.sh @@ -50,6 +50,13 @@ cp source/_templates/main.html build/html/index.html # ensure that the latest docs is the one we built if [[ $LATEST_ONLY == "0" ]]; then + # Refuse to publish a versioned subdir for pre-release or local + # versions, which otherwise leak orphan trees onto gh-pages that + # are not reachable via nv-versions.json. See #3231. + if [[ "${SPHINX_CUDA_PATHFINDER_VER}" == *.dev* || "${SPHINX_CUDA_PATHFINDER_VER}" == *+* ]]; then + echo "refusing to publish versioned docs for pre-release version '${SPHINX_CUDA_PATHFINDER_VER}'" >&2 + exit 1 + fi cp -r build/html/${SPHINX_CUDA_PATHFINDER_VER} build/html/latest else mv build/html/${SPHINX_CUDA_PATHFINDER_VER} build/html/latest