From 8b1e0072623ca0fbf56cf56245ffa80eb48922d8 Mon Sep 17 00:00:00 2001 From: Eliot McIntire Date: Wed, 5 Jun 2024 15:33:34 -0700 Subject: [PATCH 1/2] bugfix message about where modules are when there are nested modules --- DESCRIPTION | 2 +- R/getModule.R | 3 ++- tests/testthat/test-setupProject.R | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 613dc49..c03de47 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,7 @@ URL: https://spades-project.predictiveecology.org/, https://github.com/PredictiveEcology/SpaDES.project Date: 2024-06-05 -Version: 0.1.0.9002 +Version: 0.1.0.9003 Authors@R: c( person("Eliot J B", "McIntire", email = "eliot.mcintire@nrcan-rncan.gc.ca", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6914-8316")), diff --git a/R/getModule.R b/R/getModule.R index 5722edb..54fce94 100644 --- a/R/getModule.R +++ b/R/getModule.R @@ -109,7 +109,8 @@ getModule <- function(modules, modulePath, overwrite = FALSE, successes <- stateDT$moduleFullName[stateDT$sufficient %in% TRUE] failed <- stateDT$moduleFullName[!stateDT$sufficient %in% TRUE] - df <- stateDT[, list(moduleFullName, status)][, modulePath := modulePath] + stateDT[, modulePath := file.path(modulePath, fileRelPathFromFullGHpath(stateDT$moduleFullName))] + df <- stateDT[, list(moduleFullName, status, modulePath)] messageDF(df, verbose = verbose) return(list(success = successes, failed = failed)) diff --git a/tests/testthat/test-setupProject.R b/tests/testthat/test-setupProject.R index 2b48f68..5724858 100644 --- a/tests/testthat/test-setupProject.R +++ b/tests/testthat/test-setupProject.R @@ -307,6 +307,10 @@ test_that("test setupProject - nested modulePath scfm B_bDP", { }) ) + startMess <- tail(grep("modulePath", mess), 1) + 2 + endMess <- tail(grep("setting up modules", mess), 1) - 1 + modulePaths <- unlist(lapply(mess[seq(startMess, endMess)], function(x) tail(strsplit(x, split = " ")[[1]], 1))) + expect_true(length(unique(modulePaths)) == 2) expect_false(any(grepl("@", out$modules))) expect_true(all(names(out) %in% c("modules", "paths", "params", "times"))) expect_true(all(fs::path_has_parent(out$paths$modulePath, getwd()))) From 5acbe60058358929c7289036ad229b29e34ba210 Mon Sep 17 00:00:00 2001 From: Eliot McIntire Date: Wed, 5 Jun 2024 15:33:53 -0700 Subject: [PATCH 2/2] add verbose = 2 message for "seeing what reqdPkgs are in each module" --- R/setupProject.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/setupProject.R b/R/setupProject.R index 732b600..9280028 100644 --- a/R/setupProject.R +++ b/R/setupProject.R @@ -1430,6 +1430,11 @@ setupPackages <- function(packages, modulePackages = list(), require = list(), p messageVerbose("Installing any missing reqdPkgs", verbose = verbose) continue <- 3L while (continue) { + if (verbose > 1) { + outP <- capture.output(modulePackages) + messageVerbose("reqdPkgs by module:") + messageVerbose(paste(outP, collapse = "\n"), verbose = verbose) + } mp <- unlist(unname(modulePackages)) if (is(mp, "list")) { # means there was a call in modulePackages i.e., an unquoted thing like PredictiveEcology/Require mp <- substitutePackages(mp, envir = envirCur) @@ -1701,7 +1706,6 @@ parseFileLists <- function(obj, paths, namedList = TRUE, overwrite = FALSE, envi } } - if (is.character(obj)) { obj <- parseListsSequentially(files = obj, namedList = namedList, envir = envir, verbose = verbose)