Skip to content

Commit

Permalink
expose and document new option bspm.weak.deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Enchufa2 committed Aug 10, 2023
1 parent 7f14936 commit 96fa3ec
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
15 changes: 11 additions & 4 deletions R/bridge.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion R/integration.R
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
5 changes: 5 additions & 0 deletions R/options.R
Original file line number Diff line number Diff line change
@@ -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{
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions man/bspm-options.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/integration.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 96fa3ec

Please sign in to comment.