Skip to content

Commit

Permalink
Merge pull request #18 from joshuaulrich/17-relative-paths-in-config
Browse files Browse the repository at this point in the history
Allow relative paths in config file
  • Loading branch information
eddelbuettel committed Feb 21, 2023
2 parents fd0d216 + 2b9b3df commit 5c895af
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 26 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
2023-02-21 Joshua Ulrich <josh.m.ulrich@gmail.com>

* R/dequeue.R (dequeueJobs, dequeueDepends): Add relative path support
for 'libdir' and 'workdir' arguments
* R/enqueue.R (enqueueJobs, enqueueDepends): Idem
* R/summarise.R (summariseQueue): Idem
* R/utils.R: Update docs to include relative path support for
'libdir' and 'workdir' arguments
* man/getDataDirectory.Rd: Idem

2022-11-08 Dirk Eddelbuettel <edd@debian.org>

* .github/workflows/ci.yaml (jobs): Update to actions/checkout@v3
Expand Down
18 changes: 10 additions & 8 deletions R/dequeue.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ dequeueJobs <- function(package, directory, exclude=NULL, date=format(Sys.Date()
}
if ("libdir" %in% names(cfg)) {
## setting the environment variable works with littler, but not with RScript
Sys.setenv("R_LIBS_USER"=cfg$libdir)
if (!dir.exists(cfg$libdir)) {
dir.create(cfg$libdir)
fullLibDir <- normalizePath(cfg$libdir)
Sys.setenv("R_LIBS_USER"=fullLibDir)
if (!dir.exists(fullLibDir)) {
dir.create(fullLibDir)
}
env <- paste0("R_LIBS=\"", cfg$libdir, "\"")
env <- paste0("R_LIBS=\"", fullLibDir, "\"")
}
if ("verbose" %in% names(cfg)) verbose <- cfg$verbose == "true"
if ("debug" %in% names(cfg)) debug <- cfg$debug == "true"
Expand Down Expand Up @@ -146,10 +147,11 @@ dequeueDepends <- function(package, directory) {
if (!is.null(cfg <- getConfig())) {
if ("setup" %in% names(cfg)) source(cfg$setup)
if ("libdir" %in% names(cfg)) {
.libPaths(cfg$libdir)
Sys.setenv("R_LIBS_USER"=cfg$libdir)
if (!dir.exists(cfg$libdir)) {
dir.create(cfg$libdir)
fullLibDir <- normalizePath(cfg$libdir)
.libPaths(fullLibDir)
Sys.setenv("R_LIBS_USER"=fullLibDir)
if (!dir.exists(fullLibDir)) {
dir.create(fullLibDir)
}
}
}
Expand Down
18 changes: 10 additions & 8 deletions R/enqueue.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ enqueueJobs <- function(package, directory, dbfile="", addfailed=FALSE) {
if (!is.null(cfg <- getConfig())) {
if ("setup" %in% names(cfg)) source(cfg$setup)
if ("libdir" %in% names(cfg)) {
.libPaths(cfg$libdir)
Sys.setenv("R_LIBS_USER"=cfg$libdir)
if (!dir.exists(cfg$libdir)) {
dir.create(cfg$libdir)
fullLibDir <- normalizePath(cfg$libdir)
.libPaths(fullLibDir)
Sys.setenv("R_LIBS_USER"=fullLibDir)
if (!dir.exists(fullLibDir)) {
dir.create(fullLibDir)
}
}
}
Expand Down Expand Up @@ -93,10 +94,11 @@ enqueueDepends <- function(package, directory) {
if (!is.null(cfg <- getConfig())) {
if ("setup" %in% names(cfg)) source(cfg$setup)
if ("libdir" %in% names(cfg)) {
.libPaths(cfg$libdir)
Sys.setenv("R_LIBS_USER"=cfg$libdir)
if (!dir.exists(cfg$libdir)) {
dir.create(cfg$libdir)
fullLibDir <- normalizePath(cfg$libdir)
.libPaths(fullLibDir)
Sys.setenv("R_LIBS_USER"=fullLibDir)
if (!dir.exists(fullLibDir)) {
dir.create(fullLibDir)
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions R/summarise.R
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,12 @@ summariseQueue <- function(package, directory, dbfile="", extended=FALSE, foghor
}
if ("libdir" %in% names(cfg)) {
## setting the environment variable works with littler, but not with RScript
Sys.setenv("R_LIBS_USER"=cfg$libdir)
if (!dir.exists(cfg$libdir)) {
dir.create(cfg$libdir)
fullLibDir <- normalizePath(cfg$libdir)
Sys.setenv("R_LIBS_USER"=fullLibDir)
if (!dir.exists(fullLibDir)) {
dir.create(fullLibDir)
}
env <- paste0("R_LIBS=\"", cfg$libdir, "\"")
env <- paste0("R_LIBS=\"", fullLibDir, "\"")
}
if ("verbose" %in% names(cfg)) verbose <- cfg$verbose == "true"
if ("debug" %in% names(cfg)) debug <- cfg$debug == "true"
Expand Down
7 changes: 4 additions & 3 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
##' Currently supported are
##' \describe{
##' \item{setup}{The path to an R file that will be \code{source}'ed.}
##' \item{workdir}{The directory used for the parallel run of reverse depends.}
##' \item{libdir}{The directory passed to \code{.libPaths} allow for additonal
##' build-dependencies.}
##' \item{workdir}{The directory used for the parallel run of reverse depends.
##' May be an absolute or relative path.}
##' \item{libdir}{The directory passed to \code{.libPaths} allow for additional
##' build-dependencies. May be an absolute or relative path. }
##' \item{debug}{A boolean switch to enable more debugging output.}
##' \item{verbose}{A boolean switch to enable more verbose output.}
##' }
Expand Down
7 changes: 4 additions & 3 deletions man/getDataDirectory.Rd

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

0 comments on commit 5c895af

Please sign in to comment.