Skip to content

Commit 6ddbd9a

Browse files
authored
[actions] update 8 packages
1 parent 266be47 commit 6ddbd9a

File tree

2 files changed

+103
-81
lines changed

2 files changed

+103
-81
lines changed

renv/activate.R

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

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

88
# the project directory
@@ -135,12 +135,12 @@ local({
135135

136136
# R help links
137137
pattern <- "`\\?(renv::(?:[^`])+)`"
138-
replacement <- "`\033]8;;ide:help:\\1\a?\\1\033]8;;\a`"
138+
replacement <- "`\033]8;;x-r-help:\\1\a?\\1\033]8;;\a`"
139139
text <- gsub(pattern, replacement, text, perl = TRUE)
140140

141141
# runnable code
142142
pattern <- "`(renv::(?:[^`])+)`"
143-
replacement <- "`\033]8;;ide:run:\\1\a\\1\033]8;;\a`"
143+
replacement <- "`\033]8;;x-r-run:\\1\a\\1\033]8;;\a`"
144144
text <- gsub(pattern, replacement, text, perl = TRUE)
145145

146146
# return ansified text
@@ -695,11 +695,19 @@ local({
695695

696696
}
697697

698-
renv_bootstrap_platform_prefix <- function() {
698+
renv_bootstrap_platform_prefix_default <- function() {
699699

700-
# construct version prefix
701-
version <- paste(R.version$major, R.version$minor, sep = ".")
702-
prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-")
700+
# read version component
701+
version <- Sys.getenv("RENV_PATHS_VERSION", unset = "R-%v")
702+
703+
# expand placeholders
704+
placeholders <- list(
705+
list("%v", format(getRversion()[1, 1:2])),
706+
list("%V", format(getRversion()[1, 1:3]))
707+
)
708+
709+
for (placeholder in placeholders)
710+
version <- gsub(placeholder[[1L]], placeholder[[2L]], version, fixed = TRUE)
703711

704712
# include SVN revision for development versions of R
705713
# (to avoid sharing platform-specific artefacts with released versions of R)
@@ -708,10 +716,19 @@ local({
708716
identical(R.version[["nickname"]], "Unsuffered Consequences")
709717

710718
if (devel)
711-
prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r")
719+
version <- paste(version, R.version[["svn rev"]], sep = "-r")
720+
721+
version
722+
723+
}
724+
725+
renv_bootstrap_platform_prefix <- function() {
726+
727+
# construct version prefix
728+
version <- renv_bootstrap_platform_prefix_default()
712729

713730
# build list of path components
714-
components <- c(prefix, R.version$platform)
731+
components <- c(version, R.version$platform)
715732

716733
# include prefix if provided by user
717734
prefix <- renv_bootstrap_platform_prefix_impl()
@@ -950,14 +967,14 @@ local({
950967
}
951968

952969
renv_bootstrap_validate_version_dev <- function(version, description) {
953-
970+
954971
expected <- description[["RemoteSha"]]
955972
if (!is.character(expected))
956973
return(FALSE)
957-
974+
958975
pattern <- sprintf("^\\Q%s\\E", version)
959976
grepl(pattern, expected, perl = TRUE)
960-
977+
961978
}
962979

963980
renv_bootstrap_validate_version_release <- function(version, description) {
@@ -1198,86 +1215,89 @@ local({
11981215
}
11991216

12001217
renv_json_read_patterns <- function() {
1201-
1218+
12021219
list(
1203-
1220+
12041221
# objects
1205-
list("{", "\t\n\tobject(\t\n\t"),
1206-
list("}", "\t\n\t)\t\n\t"),
1207-
1222+
list("{", "\t\n\tobject(\t\n\t", TRUE),
1223+
list("}", "\t\n\t)\t\n\t", TRUE),
1224+
12081225
# arrays
1209-
list("[", "\t\n\tarray(\t\n\t"),
1210-
list("]", "\n\t\n)\n\t\n"),
1211-
1226+
list("[", "\t\n\tarray(\t\n\t", TRUE),
1227+
list("]", "\n\t\n)\n\t\n", TRUE),
1228+
12121229
# maps
1213-
list(":", "\t\n\t=\t\n\t")
1214-
1230+
list(":", "\t\n\t=\t\n\t", TRUE),
1231+
1232+
# newlines
1233+
list("\\u000a", "\n", FALSE)
1234+
12151235
)
1216-
1236+
12171237
}
12181238

12191239
renv_json_read_envir <- function() {
12201240

12211241
envir <- new.env(parent = emptyenv())
1222-
1242+
12231243
envir[["+"]] <- `+`
12241244
envir[["-"]] <- `-`
1225-
1245+
12261246
envir[["object"]] <- function(...) {
12271247
result <- list(...)
12281248
names(result) <- as.character(names(result))
12291249
result
12301250
}
1231-
1251+
12321252
envir[["array"]] <- list
1233-
1253+
12341254
envir[["true"]] <- TRUE
12351255
envir[["false"]] <- FALSE
12361256
envir[["null"]] <- NULL
1237-
1257+
12381258
envir
1239-
1259+
12401260
}
12411261

12421262
renv_json_read_remap <- function(object, patterns) {
1243-
1263+
12441264
# repair names if necessary
12451265
if (!is.null(names(object))) {
1246-
1266+
12471267
nms <- names(object)
12481268
for (pattern in patterns)
12491269
nms <- gsub(pattern[[2L]], pattern[[1L]], nms, fixed = TRUE)
12501270
names(object) <- nms
1251-
1271+
12521272
}
1253-
1273+
12541274
# repair strings if necessary
12551275
if (is.character(object)) {
12561276
for (pattern in patterns)
12571277
object <- gsub(pattern[[2L]], pattern[[1L]], object, fixed = TRUE)
12581278
}
1259-
1279+
12601280
# recurse for other objects
12611281
if (is.recursive(object))
12621282
for (i in seq_along(object))
12631283
object[i] <- list(renv_json_read_remap(object[[i]], patterns))
1264-
1284+
12651285
# return remapped object
12661286
object
1267-
1287+
12681288
}
12691289

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

12721292
# read json text
12731293
text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n")
1274-
1294+
12751295
# convert into something the R parser will understand
12761296
patterns <- renv_json_read_patterns()
12771297
transformed <- text
12781298
for (pattern in patterns)
12791299
transformed <- gsub(pattern[[1L]], pattern[[2L]], transformed, fixed = TRUE)
1280-
1300+
12811301
# parse it
12821302
rfile <- tempfile("renv-json-", fileext = ".R")
12831303
on.exit(unlink(rfile), add = TRUE)
@@ -1287,9 +1307,10 @@ local({
12871307
# evaluate in safe environment
12881308
result <- eval(json, envir = renv_json_read_envir())
12891309

1290-
# fix up strings if necessary
1310+
# fix up strings if necessary -- do so only with reversible patterns
1311+
patterns <- Filter(function(pattern) pattern[[3L]], patterns)
12911312
renv_json_read_remap(result, patterns)
1292-
1313+
12931314
}
12941315

12951316

0 commit comments

Comments
 (0)