Skip to content

Commit

Permalink
Merge pull request #504 from datacarpentry/update/packages
Browse files Browse the repository at this point in the history
Update 12 packages
  • Loading branch information
juanfung committed Mar 5, 2024
2 parents 6119f21 + 89e4a08 commit 15fe94a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 30 deletions.
39 changes: 30 additions & 9 deletions renv/activate.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
local({

# the requested version of renv
version <- "1.0.3"
version <- "1.0.5"
attr(version, "sha") <- NULL

# the project directory
Expand Down Expand Up @@ -31,6 +31,14 @@ local({
if (!is.null(override))
return(override)

# if we're being run in a context where R_LIBS is already set,
# don't load -- presumably we're being run as a sub-process and
# the parent process has already set up library paths for us
rcmd <- Sys.getenv("R_CMD", unset = NA)
rlibs <- Sys.getenv("R_LIBS", unset = NA)
if (!is.na(rlibs) && !is.na(rcmd))
return(FALSE)

# next, check environment variables
# TODO: prefer using the configuration one in the future
envvars <- c(
Expand All @@ -50,9 +58,22 @@ local({

})

if (!enabled)
# bail if we're not enabled
if (!enabled) {

# if we're not enabled, we might still need to manually load
# the user profile here
profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile")
if (file.exists(profile)) {
cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE")
if (tolower(cfg) %in% c("true", "t", "1"))
sys.source(profile, envir = globalenv())
}

return(FALSE)

}

# avoid recursion
if (identical(getOption("renv.autoloader.running"), TRUE)) {
warning("ignoring recursive attempt to run renv autoloader")
Expand Down Expand Up @@ -1041,7 +1062,7 @@ local({
# if jsonlite is loaded, use that instead
if ("jsonlite" %in% loadedNamespaces()) {

json <- catch(renv_json_read_jsonlite(file, text))
json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity)
if (!inherits(json, "error"))
return(json)

Expand All @@ -1050,7 +1071,7 @@ local({
}

# otherwise, fall back to the default JSON reader
json <- catch(renv_json_read_default(file, text))
json <- tryCatch(renv_json_read_default(file, text), error = identity)
if (!inherits(json, "error"))
return(json)

Expand All @@ -1063,14 +1084,14 @@ local({
}

renv_json_read_jsonlite <- function(file = NULL, text = NULL) {
text <- paste(text %||% read(file), collapse = "\n")
text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
jsonlite::fromJSON(txt = text, simplifyVector = FALSE)
}

renv_json_read_default <- function(file = NULL, text = NULL) {

# find strings in the JSON
text <- paste(text %||% read(file), collapse = "\n")
text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
locs <- gregexpr(pattern, text, perl = TRUE)[[1]]

Expand Down Expand Up @@ -1118,14 +1139,14 @@ local({
map <- as.list(map)

# remap strings in object
remapped <- renv_json_remap(json, map)
remapped <- renv_json_read_remap(json, map)

# evaluate
eval(remapped, envir = baseenv())

}

renv_json_remap <- function(json, map) {
renv_json_read_remap <- function(json, map) {

# fix names
if (!is.null(names(json))) {
Expand All @@ -1152,7 +1173,7 @@ local({
# recurse
if (is.recursive(json)) {
for (i in seq_along(json)) {
json[i] <- list(renv_json_remap(json[[i]], map))
json[i] <- list(renv_json_read_remap(json[[i]], map))
}
}

Expand Down
42 changes: 21 additions & 21 deletions renv/profiles/lesson-requirements/renv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"Packages": {
"DBI": {
"Package": "DBI",
"Version": "1.2.1",
"Version": "1.2.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
],
"Hash": "9b4993e98e0e19da84c168460c032fef"
"Hash": "164809cd72e1d5160b4cb3aa57f510fe"
},
"MASS": {
"Package": "MASS",
Expand All @@ -47,7 +47,7 @@
"Package": "Matrix",
"Version": "1.6-5",
"Source": "Repository",
"Repository": "CRAN",
"Repository": "RSPM",
"Requirements": [
"R",
"grDevices",
Expand Down Expand Up @@ -220,16 +220,16 @@
},
"callr": {
"Package": "callr",
"Version": "3.7.3",
"Version": "3.7.5",
"Source": "Repository",
"Repository": "RSPM",
"Repository": "CRAN",
"Requirements": [
"R",
"R6",
"processx",
"utils"
],
"Hash": "9b2191ede20fa29828139b9900922e51"
"Hash": "9f0e4fae4963ba775a5e5c520838c87b"
},
"cellranger": {
"Package": "cellranger",
Expand Down Expand Up @@ -315,24 +315,24 @@
},
"curl": {
"Package": "curl",
"Version": "5.2.0",
"Version": "5.2.1",
"Source": "Repository",
"Repository": "RSPM",
"Repository": "carpentries",
"Requirements": [
"R"
],
"Hash": "ce88d13c0b10fe88a37d9c59dba2d7f9"
"Hash": "411ca2c03b1ce5f548345d2fc2685f7a"
},
"data.table": {
"Package": "data.table",
"Version": "1.15.0",
"Version": "1.15.2",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"R",
"methods"
],
"Hash": "cfbbb4aed6e78cd45f17123a9ec9981a"
"Hash": "536dfe4ac4093b5d115caed7a1a7223b"
},
"dbplyr": {
"Package": "dbplyr",
Expand Down Expand Up @@ -537,7 +537,7 @@
},
"ggplot2": {
"Package": "ggplot2",
"Version": "3.4.4",
"Version": "3.5.0",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
Expand All @@ -558,7 +558,7 @@
"vctrs",
"withr"
],
"Hash": "313d31eff2274ecf4c1d3581db7241f9"
"Hash": "52ef83f93f74833007f193b2d4c159a2"
},
"glue": {
"Package": "glue",
Expand Down Expand Up @@ -1113,13 +1113,13 @@
},
"renv": {
"Package": "renv",
"Version": "1.0.3",
"Version": "1.0.5",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"utils"
],
"Hash": "41b847654f567341725473431dd0d5ab"
"Hash": "32c3f93e8360f667ca5863272ec8ba6a"
},
"reprex": {
"Package": "reprex",
Expand Down Expand Up @@ -1197,9 +1197,9 @@
},
"rvest": {
"Package": "rvest",
"Version": "1.0.3",
"Version": "1.0.4",
"Source": "Repository",
"Repository": "RSPM",
"Repository": "CRAN",
"Requirements": [
"R",
"cli",
Expand All @@ -1210,10 +1210,9 @@
"rlang",
"selectr",
"tibble",
"withr",
"xml2"
],
"Hash": "a4a5ac819a467808c60e36e92ddf195e"
"Hash": "0bcf0c6f274e90ea314b812a6d19a519"
},
"sass": {
"Package": "sass",
Expand Down Expand Up @@ -1536,14 +1535,15 @@
},
"xfun": {
"Package": "xfun",
"Version": "0.41",
"Version": "0.42",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"grDevices",
"stats",
"tools"
],
"Hash": "460a5e0fe46a80ef87424ad216028014"
"Hash": "fd1349170df31f7a10bd98b0189e85af"
},
"xml2": {
"Package": "xml2",
Expand Down

0 comments on commit 15fe94a

Please sign in to comment.