installable: Only panic without sphinx if FISH_BUILD_DOCS=1
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run

It's pretty annoying that this panics without sphinx, because the
install itself would be *working*.

So instead we tell the user that they need to clean or set
$FISH_BUILD_DOCS if they want to try again.
This commit is contained in:
Fabian Boehm 2024-12-14 20:23:52 +01:00
parent 46ce01223b
commit 10ac98e2ea
2 changed files with 10 additions and 4 deletions

View File

@ -185,11 +185,13 @@ This will place the binaries in ``~/.cargo/bin/``, but you can place them wherev
This build won't have the HTML docs (``help`` will open the online version) or translations. This build won't have the HTML docs (``help`` will open the online version) or translations.
It requires sphinx by default, if sphinx-build is not available you can build without man pages by running it with $FISH_BUILD_DOCS set to 0:: It will try to build the man pages with sphinx-build. If that is not available and you would like to include man pages, you need to install it and retrigger the build script, e.g. by setting FISH_BUILD_DOCS=1::
FISH_BUILD_DOCS=0 cargo install --path . FISH_BUILD_DOCS=1 cargo install --path .
You can also link it statically (but not against glibc) and move it to other computers. Setting it to "0" disables the inclusion of man pages.
You can also link this build statically (but not against glibc) and move it to other computers.
Contributing Changes to the Code Contributing Changes to the Code
-------------------------------- --------------------------------

View File

@ -378,8 +378,12 @@ fn build_man(build_dir: &Path) {
// which is unfortunate - but the docs are pretty important because they're also used for --help. // which is unfortunate - but the docs are pretty important because they're also used for --help.
match Command::new("sphinx-build").args(args).spawn() { match Command::new("sphinx-build").args(args).spawn() {
Err(x) if x.kind() == std::io::ErrorKind::NotFound => { Err(x) if x.kind() == std::io::ErrorKind::NotFound => {
if env::var("FISH_BUILD_DOCS") == Ok("1".to_string()) {
panic!("Could not find sphinx-build to build man pages.\nInstall sphinx or disable building the docs by setting $FISH_BUILD_DOCS=0."); panic!("Could not find sphinx-build to build man pages.\nInstall sphinx or disable building the docs by setting $FISH_BUILD_DOCS=0.");
} }
println!("cargo:warning=Cannot find sphinx-build to build man pages.");
println!("cargo:warning=If you install it now you need to run `cargo clean` and rebuild, or set $FISH_BUILD_DOCS=1 explicitly.");
}
Err(x) => { Err(x) => {
// Another error - permissions wrong etc // Another error - permissions wrong etc
panic!("Error starting sphinx-build to build man pages: {:?}", x); panic!("Error starting sphinx-build to build man pages: {:?}", x);