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
This commit is contained in:
Daniel Rainer
2026-01-11 18:18:51 +01:00
committed by Johannes Altmanninger
parent a79c54be66
commit 36c340b40f
2 changed files with 6 additions and 16 deletions

View File

@@ -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.

View File

@@ -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]