Skip to content

Commit

Permalink
reflects the upstream install2.r script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi committed Sep 4, 2022
1 parent 2915366 commit 7af4e84
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/bin/install2.r
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
#
# Copyright (C) 2011 - 2014 Dirk Eddelbuettel
# Copyright (C) 2014 - 2017 Carl Boettiger and Dirk Eddelbuettel
# Copyright (C) 2018 Carl Boettiger, Dirk Eddelbuettel, and Brandon Bertelsen
# Copyright (C) 2018 - 2022 Carl Boettiger, Dirk Eddelbuettel, Brandon Bertelsen, and SHIMA Tatsuya
#
# Released under GPL (>= 2)

## load docopt package from CRAN
library(docopt)

## default to first library location in .libPaths()
libloc <- .libPaths()[1]

## configuration for docopt
doc <- "Usage: install2.r [-l LIBLOC] [-h] [-x] [-s] [-d DEPS] [-n NCPUS] [-r REPOS...] [-m METHOD] [--error] [--skipmissing] [--] [PACKAGES ...]
doc <- paste0("Usage: install2.r [-l LIBLOC] [-h] [-x] [-s] [-d DEPS] [-n NCPUS] [-r REPOS...] [-m METHOD] [--error] [--skipmissing] [--] [PACKAGES ...]
-l --libloc LIBLOC location in which to install [default: /usr/local/lib/R/site-library]
-l --libloc LIBLOC location in which to install [default: ", libloc, "]
-d --deps DEPS install suggested dependencies as well [default: NA]
-n --ncpus NCPUS number of processes to use for parallel install [default: getOption]
-r --repos REPOS repositor(y|ies) to use, or NULL for file [default: getOption]
Expand All @@ -23,7 +26,7 @@ doc <- "Usage: install2.r [-l LIBLOC] [-h] [-x] [-s] [-d DEPS] [-n NCPUS] [-r RE
-s --skipinstalled skip installing already installed packages [default: FALSE]
-m --method METHOD method to be used for downloading files [default: auto]
-h --help show this help text
-x --usage show help and short example usage"
-x --usage show help and short example usage")
opt <- docopt(doc) # docopt parsing

if (opt$usage) {
Expand Down Expand Up @@ -79,7 +82,7 @@ install_packages2 <- function(pkgs, ..., error = FALSE, skipmissing = FALSE, ski
grepl("download of package .* failed", e$message) ||
(grepl("(dependenc|package).*(is|are) not available", e$message) && !skipmissing) ||
grepl("installation of package.*had non-zero exit status", e$message) ||
grepl("installation of one or more packages failed", e$message)
grepl("installation of .+ packages failed", e$message)
if (catch) {
e <<- e
}
Expand Down

0 comments on commit 7af4e84

Please sign in to comment.