From 36c340b40f90f174802f1cf6413336381ac7ffde Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Sun, 11 Jan 2026 18:18:51 +0100 Subject: [PATCH] cmake: remove obsolete version env var The `FISH_BUILD_VERSION_FILE` variable was only read in `doc_src/conf.py`. There, it can be replaced by the `build_tools/git_version_gen.sh` script, which takes the version from a file called `version` at the workspace root if one exists, and otherwise from git. This should cover all cases where the docs are built, so there is no need to keep using the `FISH_BUILD_VERSION_FILE` variable. Part of #12307 --- cmake/Docs.cmake | 8 ++------ doc_src/conf.py | 14 ++++---------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/cmake/Docs.cmake b/cmake/Docs.cmake index f6b3852da..a4c859f41 100644 --- a/cmake/Docs.cmake +++ b/cmake/Docs.cmake @@ -24,8 +24,7 @@ endif() add_custom_target(sphinx-docs mkdir -p ${SPHINX_HTML_DIR}/_static/ - COMMAND env FISH_BUILD_VERSION_FILE=${CMAKE_CURRENT_BINARY_DIR}/${FBVF} - PATH="${SPHINX_HTML_FISH_INDENT_PATH}:$$PATH" + COMMAND env PATH="${SPHINX_HTML_FISH_INDENT_PATH}:$$PATH" ${SPHINX_EXECUTABLE} -j auto -q -b html @@ -34,21 +33,18 @@ add_custom_target(sphinx-docs "${SPHINX_SRC_DIR}" "${SPHINX_HTML_DIR}" DEPENDS - CHECK-FISH-BUILD-VERSION-FILE ${SPHINX_SRC_DIR}/fish_indent_lexer.py ${SPHINX_HTML_FISH_INDENT_DEP} COMMENT "Building HTML documentation with Sphinx") add_custom_target(sphinx-manpages - env FISH_BUILD_VERSION_FILE=${CMAKE_CURRENT_BINARY_DIR}/${FBVF} - ${SPHINX_EXECUTABLE} + ${SPHINX_EXECUTABLE} -j auto -q -b man -c "${SPHINX_SRC_DIR}" -d "${SPHINX_ROOT_DIR}/.doctrees-man" "${SPHINX_SRC_DIR}" "${SPHINX_MANPAGE_DIR}/man1" - DEPENDS CHECK-FISH-BUILD-VERSION-FILE COMMENT "Building man pages with Sphinx") if(NOT DEFINED WITH_DOCS) # Don't check for legacy options if the new one is defined, to help bisecting. diff --git a/doc_src/conf.py b/doc_src/conf.py index 80ddc4d8c..6fe07183a 100644 --- a/doc_src/conf.py +++ b/doc_src/conf.py @@ -117,16 +117,10 @@ copyright = "fish-shell developers" 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 -if "FISH_BUILD_VERSION_FILE" in os.environ: - # From Cmake - f = open(os.environ["FISH_BUILD_VERSION_FILE"], "r") - ret = f.readline().strip() -else: - # From Cargo, or no build system. - ret = subprocess.check_output( - ("../build_tools/git_version_gen.sh", "--stdout"), stderr=subprocess.STDOUT - ).decode("utf-8") +# From Cargo, or no build system. +ret = subprocess.check_output( + ("../build_tools/git_version_gen.sh", "--stdout"), stderr=subprocess.STDOUT +).decode("utf-8") # The full version, including alpha/beta/rc tags release = ret.strip().split(" ")[-1]