docs: Read version from the version file

Makes it possible to generate the man pages without fish_indent
available.

(not the html docs because they highlight via fish_indent!)
This commit is contained in:
Fabian Boehm
2024-11-18 21:37:50 +01:00
parent 7c73c5fec0
commit 2343a6b1f1
3 changed files with 16 additions and 9 deletions

View File

@@ -65,9 +65,16 @@ 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
ret = subprocess.check_output(
("fish_indent", "--version"), stderr=subprocess.STDOUT
).decode("utf-8")
if "FISH_BUILD_VERSION_FILE" in os.environ:
f = open(os.environ["FISH_BUILD_VERSION_FILE"], "r")
ret = f.readline().strip()
elif "FISH_BUILD_VERSION" in os.environ:
ret = os.environ["FISH_BUILD_VERSION"]
else:
ret = subprocess.check_output(
("fish_indent", "--version"), stderr=subprocess.STDOUT
).decode("utf-8")
# The full version, including alpha/beta/rc tags
release = ret.strip().split(" ")[-1]
# The short X.Y version