From 79d406e9183aa12cdef6f1876eb9a15385662587 Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Fri, 5 Jul 2024 12:44:40 -0700 Subject: [PATCH] [Docs] Fix readthedocs for tag build (#6158) --- docs/source/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 46a3bcbf10a85..f4cec05663fcd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -75,7 +75,10 @@ # remove the warning banner if the version is a tagged release header_file = os.path.join(os.path.dirname(__file__), "_templates/sections/header.html") - os.remove(header_file) + # 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(header_file): + os.remove(header_file) # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files,