From 48d463ea21d7fe4b4143374c5857a49a860282e7 Mon Sep 17 00:00:00 2001 From: Dewey Dunnington Date: Tue, 15 Aug 2023 10:49:44 -0300 Subject: [PATCH] only build docs for installed packages --- ci/scripts/docs_build.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ci/scripts/docs_build.sh b/ci/scripts/docs_build.sh index 0cd14b4e26..0b268b1acc 100755 --- a/ci/scripts/docs_build.sh +++ b/ci/scripts/docs_build.sh @@ -33,7 +33,12 @@ main() { for desc_file in $(find "${source_dir}/r" -name DESCRIPTION); do local pkg=$(dirname "$desc_file") local pkg_name=$(basename $pkg) - R -e "pkgdown::build_site_github_pages(pkg = '$pkg', dest_dir = '$source_dir/docs/build/html/r/$pkg_name')" + # Only build R documentation for installed packages (e.g., so that + # Python's documentation build can run without installing the R + # packages). Packages are installed in ci/scripts/r_build.sh + if Rscript -e "requireNamespace('$pkg')"; then + R -e "pkgdown::build_site_github_pages(pkg = '$pkg', dest_dir = '$source_dir/docs/build/html/r/$pkg_name')" + fi done }