diff --git a/renv/activate.R b/renv/activate.R index ef25ef83..93d4f65b 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,8 +2,8 @@ local({ # the requested version of renv - version <- "1.1.7" - attr(version, "md5") <- "dd5d60f155dadff4c88c2fc6680504b4" + version <- "1.2.0" + attr(version, "md5") <- "b7d230b07507f361d3bcf794d157a188" attr(version, "sha") <- NULL # the project directory @@ -226,13 +226,17 @@ local({ section <- header(sprintf("Bootstrapping renv %s", friendly)) catf(section) + # ensure the target library path exists; required for file.copy(..., recursive = TRUE) + dir.create(library, showWarnings = FALSE, recursive = TRUE) + # try to install renv from cache md5 <- attr(version, "md5", exact = TRUE) if (length(md5)) { pkgpath <- renv_bootstrap_find(version) if (length(pkgpath) && file.exists(pkgpath)) { - file.copy(pkgpath, library, recursive = TRUE) - return(invisible()) + ok <- file.copy(pkgpath, library, recursive = TRUE) + if (isTRUE(ok)) + return(invisible()) } } @@ -1231,6 +1235,21 @@ local({ } renv_bootstrap_run <- function(project, libpath, version) { + tryCatch( + renv_bootstrap_run_impl(project, libpath, version), + error = function(e) { + msg <- paste( + "failed to bootstrap renv: the project will not be loaded.", + paste("Reason:", conditionMessage(e)), + "Use `renv::activate()` to re-initialize the project.", + sep = "\n" + ) + warning(msg, call. = FALSE) + } + ) + } + + renv_bootstrap_run_impl <- function(project, libpath, version) { # perform bootstrap bootstrap(version, libpath) diff --git a/renv/profiles/lesson-requirements/renv.lock b/renv/profiles/lesson-requirements/renv.lock index a6438c5d..44e7aae5 100644 --- a/renv/profiles/lesson-requirements/renv.lock +++ b/renv/profiles/lesson-requirements/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.5.2", + "Version": "4.5.3", "Repositories": [ { "Name": "carpentries", @@ -19,7 +19,7 @@ "Packages": { "renv": { "Package": "renv", - "Version": "1.1.7", + "Version": "1.2.0", "Source": "Repository", "Type": "Package", "Title": "Project Environments", @@ -61,16 +61,16 @@ "webfakes" ], "Encoding": "UTF-8", + "NeedsCompilation": "yes", "RoxygenNote": "7.3.3", "VignetteBuilder": "knitr", "Config/Needs/website": "tidyverse/tidytemplate", "Config/testthat/edition": "3", "Config/testthat/parallel": "true", "Config/testthat/start-first": "bioconductor,python,install,restore,snapshot,retrieve,remotes", - "NeedsCompilation": "no", "Author": "Kevin Ushey [aut, cre] (ORCID: ), Hadley Wickham [aut] (ORCID: ), Posit Software, PBC [cph, fnd]", "Maintainer": "Kevin Ushey ", - "Repository": "CRAN" + "Repository": "https://packagemanager.posit.co/cran/__linux__/jammy/latest" } } }