mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
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:
parent
7c73c5fec0
commit
2343a6b1f1
3 changed files with 16 additions and 9 deletions
8
build.rs
8
build.rs
|
@ -29,12 +29,12 @@ fn main() {
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let version = &get_version(&env::current_dir().unwrap());
|
||||||
// Per https://doc.rust-lang.org/cargo/reference/build-scripts.html#inputs-to-the-build-script,
|
// Per https://doc.rust-lang.org/cargo/reference/build-scripts.html#inputs-to-the-build-script,
|
||||||
// the source directory is the current working directory of the build script
|
// the source directory is the current working directory of the build script
|
||||||
rsconf::set_env_value(
|
rsconf::set_env_value("FISH_BUILD_VERSION", version);
|
||||||
"FISH_BUILD_VERSION",
|
|
||||||
&get_version(&env::current_dir().unwrap()),
|
std::env::set_var("FISH_BUILD_VERSION", version);
|
||||||
);
|
|
||||||
|
|
||||||
rsconf::rebuild_if_path_changed("src/libc.c");
|
rsconf::rebuild_if_path_changed("src/libc.c");
|
||||||
cc::Build::new()
|
cc::Build::new()
|
||||||
|
|
|
@ -29,7 +29,7 @@ add_custom_target(sphinx-docs
|
||||||
|
|
||||||
# sphinx-manpages needs the fish_indent binary for the version number
|
# sphinx-manpages needs the fish_indent binary for the version number
|
||||||
add_custom_target(sphinx-manpages
|
add_custom_target(sphinx-manpages
|
||||||
env PATH="${CMAKE_BINARY_DIR}:$$PATH"
|
env FISH_BUILD_VERSION_FILE="${CMAKE_CURRENT_BINARY_DIR}/${FBVF}"
|
||||||
${SPHINX_EXECUTABLE}
|
${SPHINX_EXECUTABLE}
|
||||||
-j auto
|
-j auto
|
||||||
-q -b man
|
-q -b man
|
||||||
|
@ -38,7 +38,7 @@ add_custom_target(sphinx-manpages
|
||||||
"${SPHINX_SRC_DIR}"
|
"${SPHINX_SRC_DIR}"
|
||||||
# TODO: This only works if we only have section 1 manpages.
|
# TODO: This only works if we only have section 1 manpages.
|
||||||
"${SPHINX_MANPAGE_DIR}/man1"
|
"${SPHINX_MANPAGE_DIR}/man1"
|
||||||
DEPENDS fish_indent
|
DEPENDS CHECK-FISH-BUILD-VERSION-FILE
|
||||||
COMMENT "Building man pages with Sphinx")
|
COMMENT "Building man pages with Sphinx")
|
||||||
|
|
||||||
if(SPHINX_EXECUTABLE)
|
if(SPHINX_EXECUTABLE)
|
||||||
|
|
|
@ -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
|
# 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
|
# fish_indent is guaranteed to be on PATH for the Pygments highlighter anyway
|
||||||
ret = subprocess.check_output(
|
if "FISH_BUILD_VERSION_FILE" in os.environ:
|
||||||
("fish_indent", "--version"), stderr=subprocess.STDOUT
|
f = open(os.environ["FISH_BUILD_VERSION_FILE"], "r")
|
||||||
).decode("utf-8")
|
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
|
# The full version, including alpha/beta/rc tags
|
||||||
release = ret.strip().split(" ")[-1]
|
release = ret.strip().split(" ")[-1]
|
||||||
# The short X.Y version
|
# The short X.Y version
|
||||||
|
|
Loading…
Reference in a new issue