Skip to content

Commit c342f4c

Browse files
authored
Merge pull request #187 from carpentries/update/packages
Update 2 packages
2 parents 334f35c + 6d417f1 commit c342f4c

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

renv/activate.R

+30-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
local({
33

44
# the requested version of renv
5-
version <- "1.0.3"
5+
version <- "1.0.5"
66
attr(version, "sha") <- NULL
77

88
# the project directory
@@ -31,6 +31,14 @@ local({
3131
if (!is.null(override))
3232
return(override)
3333

34+
# if we're being run in a context where R_LIBS is already set,
35+
# don't load -- presumably we're being run as a sub-process and
36+
# the parent process has already set up library paths for us
37+
rcmd <- Sys.getenv("R_CMD", unset = NA)
38+
rlibs <- Sys.getenv("R_LIBS", unset = NA)
39+
if (!is.na(rlibs) && !is.na(rcmd))
40+
return(FALSE)
41+
3442
# next, check environment variables
3543
# TODO: prefer using the configuration one in the future
3644
envvars <- c(
@@ -50,9 +58,22 @@ local({
5058

5159
})
5260

53-
if (!enabled)
61+
# bail if we're not enabled
62+
if (!enabled) {
63+
64+
# if we're not enabled, we might still need to manually load
65+
# the user profile here
66+
profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile")
67+
if (file.exists(profile)) {
68+
cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE")
69+
if (tolower(cfg) %in% c("true", "t", "1"))
70+
sys.source(profile, envir = globalenv())
71+
}
72+
5473
return(FALSE)
5574

75+
}
76+
5677
# avoid recursion
5778
if (identical(getOption("renv.autoloader.running"), TRUE)) {
5879
warning("ignoring recursive attempt to run renv autoloader")
@@ -1041,7 +1062,7 @@ local({
10411062
# if jsonlite is loaded, use that instead
10421063
if ("jsonlite" %in% loadedNamespaces()) {
10431064

1044-
json <- catch(renv_json_read_jsonlite(file, text))
1065+
json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity)
10451066
if (!inherits(json, "error"))
10461067
return(json)
10471068

@@ -1050,7 +1071,7 @@ local({
10501071
}
10511072

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

@@ -1063,14 +1084,14 @@ local({
10631084
}
10641085

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

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

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

@@ -1118,14 +1139,14 @@ local({
11181139
map <- as.list(map)
11191140

11201141
# remap strings in object
1121-
remapped <- renv_json_remap(json, map)
1142+
remapped <- renv_json_read_remap(json, map)
11221143

11231144
# evaluate
11241145
eval(remapped, envir = baseenv())
11251146

11261147
}
11271148

1128-
renv_json_remap <- function(json, map) {
1149+
renv_json_read_remap <- function(json, map) {
11291150

11301151
# fix names
11311152
if (!is.null(names(json))) {
@@ -1152,7 +1173,7 @@ local({
11521173
# recurse
11531174
if (is.recursive(json)) {
11541175
for (i in seq_along(json)) {
1155-
json[i] <- list(renv_json_remap(json[[i]], map))
1176+
json[i] <- list(renv_json_read_remap(json[[i]], map))
11561177
}
11571178
}
11581179

renv/profiles/lesson-requirements/renv.lock

+5-4
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@
274274
},
275275
"renv": {
276276
"Package": "renv",
277-
"Version": "1.0.3",
277+
"Version": "1.0.5",
278278
"Source": "Repository",
279279
"Repository": "CRAN",
280280
"Requirements": [
281281
"utils"
282282
],
283-
"Hash": "41b847654f567341725473431dd0d5ab"
283+
"Hash": "32c3f93e8360f667ca5863272ec8ba6a"
284284
},
285285
"rlang": {
286286
"Package": "rlang",
@@ -387,14 +387,15 @@
387387
},
388388
"xfun": {
389389
"Package": "xfun",
390-
"Version": "0.41",
390+
"Version": "0.42",
391391
"Source": "Repository",
392392
"Repository": "CRAN",
393393
"Requirements": [
394+
"grDevices",
394395
"stats",
395396
"tools"
396397
],
397-
"Hash": "460a5e0fe46a80ef87424ad216028014"
398+
"Hash": "fd1349170df31f7a10bd98b0189e85af"
398399
},
399400
"yaml": {
400401
"Package": "yaml",

0 commit comments

Comments
 (0)