Skip to content

Commit

Permalink
Add R 3.1 checking, but can't find a good candidate to test
Browse files Browse the repository at this point in the history
  • Loading branch information
chainsawriot committed Feb 28, 2023
1 parent 2c8fd0f commit ddb37a9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions inst/header.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,19 @@
fileext)
}

.build_raw_tarball <- function(raw_tarball_path, x, version, tarball_path) {
.build_raw_tarball <- function(raw_tarball_path, x, version, tarball_path, current_r_version) {
if (utils::compareVersion(current_r_version, "3.1") != -1) {
vignetteflag <- "--no-build-vignettes"
} else {
vignetteflag <- "--no-vignettes"
}
tmp_dir <- .tempfile(fileext = "")
dir.create(tmp_dir)
system(command = paste("tar", "-zxf ", raw_tarball_path, "-C", tmp_dir))
pkg_dir <- list.files(path = tmp_dir, full.names = TRUE)[1]
new_pkg_dir <- file.path(tmp_dir, x)
file.rename(pkg_dir, new_pkg_dir)
res <- system(command = paste("R", "CMD", "build", "--no-build-vignettes", new_pkg_dir)) ## TODO: version dependent
res <- system(command = paste("R", "CMD", "build", vignetteflag, new_pkg_dir))
expected_tarball_path <- paste(x, "_", version, ".tar.gz", sep = "")
stopifnot(file.exists(expected_tarball_path))
file.rename(expected_tarball_path, tarball_path)
Expand All @@ -68,7 +73,8 @@
uid = uid, verbose = verbose, cran_mirror = cran_mirror, bioc_mirror = bioc_mirror)
}
if (file.exists(raw_tarball_path)) {
tarball_path <- .build_raw_tarball(raw_tarball_path, x = x, version = version, tarball_path)
tarball_path <- .build_raw_tarball(raw_tarball_path, x = x, version = version, tarball_path,
current_r_version = current_r_version)
if (!file.exists(tarball_path)) {
stop("building failed.")
}
Expand Down

0 comments on commit ddb37a9

Please sign in to comment.