From 7975060e4adc9decb9f5bdf97a1a5c1b4cf8ccad Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Mon, 29 Dec 2025 11:29:21 +0100 Subject: [PATCH] docs: consistently use FISH_BUILD_VERSION_FILE Commit 2343a6b1f19 passed the FISH_BUILD_VERSION_FILE to sphinx-manpages to remove the fish_indent dependency. For sphinx-docs this has been solved in another way in e895f96f8a0 (Do not rely on `fish_indent` for version in Sphinx, 2025-08-19). This is a needless inconsistency. Remove it. Use FISH_BUILD_VERSION_FILE whenever possible, since that means that a full build process only needs to call git_version_gen.sh once. Keep the fallback to git_version_gen.sh, in case someone calls sphinx-build directly. --- cmake/Docs.cmake | 5 +++-- doc_src/conf.py | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/Docs.cmake b/cmake/Docs.cmake index d3cb01518..48482a12d 100644 --- a/cmake/Docs.cmake +++ b/cmake/Docs.cmake @@ -16,7 +16,8 @@ set(SPHINX_MANPAGE_DIR "${SPHINX_ROOT_DIR}/man") # Prepend the output dir of fish_indent to PATH. add_custom_target(sphinx-docs mkdir -p ${SPHINX_HTML_DIR}/_static/ - COMMAND env PATH="${CMAKE_BINARY_DIR}:$$PATH" + COMMAND env FISH_BUILD_VERSION_FILE=${CMAKE_CURRENT_BINARY_DIR}/${FBVF} + PATH="${CMAKE_BINARY_DIR}:$$PATH" ${SPHINX_EXECUTABLE} -j auto -q -b html @@ -24,7 +25,7 @@ add_custom_target(sphinx-docs -d "${SPHINX_ROOT_DIR}/.doctrees-html" "${SPHINX_SRC_DIR}" "${SPHINX_HTML_DIR}" - DEPENDS ${SPHINX_SRC_DIR}/fish_indent_lexer.py fish_indent + DEPENDS CHECK-FISH-BUILD-VERSION-FILE ${SPHINX_SRC_DIR}/fish_indent_lexer.py fish_indent COMMENT "Building HTML documentation with Sphinx") add_custom_target(sphinx-manpages diff --git a/doc_src/conf.py b/doc_src/conf.py index 0da3834b2..17a8e5241 100644 --- a/doc_src/conf.py +++ b/doc_src/conf.py @@ -118,13 +118,15 @@ author = "fish-shell developers" issue_url = "https://github.com/fish-shell/fish-shell/issues" # Parsing FISH-BUILD-VERSION-FILE is possible but hard to ensure that it is in the right place -# fish_indent is guaranteed to be on PATH for the Pygments highlighter anyway if "FISH_BUILD_VERSION_FILE" in os.environ: + # From Cmake f = open(os.environ["FISH_BUILD_VERSION_FILE"], "r") ret = f.readline().strip() elif "FISH_BUILD_VERSION" in os.environ: + # From Cargo ret = os.environ["FISH_BUILD_VERSION"] else: + # No build system. ret = subprocess.check_output( ("../build_tools/git_version_gen.sh", "--stdout"), stderr=subprocess.STDOUT ).decode("utf-8")