From 96fa3ecf54819282a609b4350de5412410a5020b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20=C3=9Acar?= Date: Thu, 10 Aug 2023 21:08:34 +0200 Subject: [PATCH] expose and document new option bspm.weak.deps --- R/bridge.R | 15 +++++++++++---- R/integration.R | 2 +- R/options.R | 5 +++++ man/bspm-options.Rd | 5 +++++ man/integration.Rd | 2 +- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/R/bridge.R b/R/bridge.R index 0b0f1ce..603dada 100644 --- a/R/bridge.R +++ b/R/bridge.R @@ -76,8 +76,11 @@ root_call <- function(method, pkgs, sudo=NULL) { cmd <- system.file("service/bspm.py", package="bspm") args <- c(method, "-o", tmp) - if (!missing(pkgs)) + if (!missing(pkgs)) { + if (!is.null(weak.deps <- getOption("bspm.weak.deps", NULL))) + args <- c(args, paste0("--", if (!weak.deps) "no-", "weak-deps")) args <- c(args, pkgs) + } if (!is.null(sudo)) { args <- c(cmd, args) cmd <- sudo @@ -107,9 +110,13 @@ dbus_call <- function(method, pkgs) { cmd <- Sys.which("busctl") args <- c("call", "--timeout=1h", BUS_NAME, OPATH, IFACE, method) - if (!missing(pkgs)) - args <- c(args, "ias", Sys.getpid(), length(pkgs), pkgs) - else args <- c(args, "i", Sys.getpid()) + if (missing(pkgs)) { + args <- c(args, "i", Sys.getpid()) + } else { + weak.deps <- getOption("bspm.weak.deps", NULL) + sign <- paste0("ias", if (!is.null(weak.deps)) "b") + args <- c(args, sign, Sys.getpid(), length(pkgs), pkgs, weak.deps) + } out <- system2nowarn(cmd, args, stdout=TRUE, stderr=TRUE) if (!length(out)) diff --git a/R/integration.R b/R/integration.R index 33a1d10..a9b4626 100644 --- a/R/integration.R +++ b/R/integration.R @@ -27,7 +27,7 @@ #' \emph{fast} mode can be enabled via \code{options(bspm.version.check=FALSE)}, #' (true by default) which completely skips version checking. #' -#' @seealso \code{\link{manager}} +#' @seealso \code{\link{manager}}, \code{\link{bspm-options}} #' #' @examples #' \dontrun{ diff --git a/R/options.R b/R/options.R index bc3c7ba..8bdd7c3 100644 --- a/R/options.R +++ b/R/options.R @@ -1,6 +1,7 @@ #' Package Options #' #' List of \code{\link{options}()} supported to configure \pkg{bspm}'s behavior. +#' In general, these should be set \emph{before} calling any package function. #' #' @section Options specific to \pkg{bspm}: #' \describe{ @@ -9,6 +10,10 @@ #' \item{\code{bspm.version.check}:}{logical, default \code{TRUE}. If false, #' as many binaries are installed as possible without any version check, #' and then installation from source is used as a fallback.} +#' \item{\code{bspm.weak.deps}:}{logical, default \code{NULL}, i.e. does not +#' change the system's default. If true (or false=, it forces the installation +#' (or avoids the installation) of weak dependencies (i.e. recommended or +#' suggested packages).} #' \item{\code{bspm.sudo.autodetect}:}{logical, default \code{FALSE}. If true, #' enables autodetection and selection of password-less \code{sudo}.} #' \item{\code{bspm.sudo}:}{logical, default \code{FALSE}. If true, forces diff --git a/man/bspm-options.Rd b/man/bspm-options.Rd index fb5c633..9e295b2 100644 --- a/man/bspm-options.Rd +++ b/man/bspm-options.Rd @@ -5,6 +5,7 @@ \title{Package Options} \description{ List of \code{\link{options}()} supported to configure \pkg{bspm}'s behavior. +In general, these should be set \emph{before} calling any package function. } \section{Options specific to \pkg{bspm}}{ @@ -14,6 +15,10 @@ List of \code{\link{options}()} supported to configure \pkg{bspm}'s behavior. \item{\code{bspm.version.check}:}{logical, default \code{TRUE}. If false, as many binaries are installed as possible without any version check, and then installation from source is used as a fallback.} +\item{\code{bspm.weak.deps}:}{logical, default \code{NULL}, i.e. does not + change the system's default. If true (or false=, it forces the installation + (or avoids the installation) of weak dependencies (i.e. recommended or + suggested packages).} \item{\code{bspm.sudo.autodetect}:}{logical, default \code{FALSE}. If true, enables autodetection and selection of password-less \code{sudo}.} \item{\code{bspm.sudo}:}{logical, default \code{FALSE}. If true, forces diff --git a/man/integration.Rd b/man/integration.Rd index 9550745..ec41818 100644 --- a/man/integration.Rd +++ b/man/integration.Rd @@ -52,5 +52,5 @@ install.packages("errors") } \seealso{ -\code{\link{manager}} +\code{\link{manager}}, \code{\link{bspm-options}} }