nix: Move docs build and serve scripts into nix

This is long overdue. We expect everyone contributing to postgrest to use the nix tools,
so it makes no sense to carry around external tools anymore.
This commit is contained in:
Wolfgang Walther
2024-02-18 13:10:00 +01:00
committed by Wolfgang Walther
parent 3750f35e3f
commit b435f1b2d4
3 changed files with 56 additions and 58 deletions
-31
View File
@@ -1,31 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
# sphinx-intl fails if LC_ALL is not set
export LC_ALL=${LC_ALL:-C}
function build() {
sphinx-build --color -W -a -n . -b "$@"
}
if [ "${1:-}" == "" ]; then
# clean previous build, otherwise some errors might be supressed
rm -rf "_build/html/default"
if [ -d languages ]; then
# default to updating all existing locales
build gettext _build/gettext
sphinx-intl update -p _build/gettext
fi
build html "_build/html/default"
else
# clean previous build, otherwise some errors might be supressed
rm -rf "_build/html/$1"
# update and build specific locale, can be used to create new locale
build gettext _build/gettext
sphinx-intl update -p _build/gettext -l "$1"
build html "_build/html/$1" -D "language=$1"
fi
-18
View File
@@ -1,18 +0,0 @@
#!/usr/bin/env python
import sys
from livereload import Server, shell
from subprocess import call
if len(sys.argv) == 1 or sys.argv[1] == "":
locale = "default"
build = "./build.sh"
else:
locale = sys.argv[1]
build = f"./build.sh {locale}"
call(build, shell=True)
server = Server()
server.watch("**/*.rst", shell(build))
server.watch(f"locales/{locale}/LC_MESSAGES/*.po", shell(build))
server.serve(root=f"_build/html/{locale}")