From 33990d325591588f684584e88bb979a84a48aad3 Mon Sep 17 00:00:00 2001 From: catalamarti Date: Sun, 28 Jul 2024 01:03:56 +0100 Subject: [PATCH 1/2] Use httr conditionally --- NEWS.md | 3 +++ R/check-mac.R | 1 + R/release.R | 1 + R/run-source.R | 1 + 4 files changed, 6 insertions(+) diff --git a/NEWS.md b/NEWS.md index 30c1fbf1a..4ba5ce6c7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # devtools (development version) +* Use `httr` package conditionally with `rlang::check_installed("httr")` + (#2573). + * `test_coverage()` now works if the package has not been installed. * `test_coverage_active_file()` now reports if any tests failed and does diff --git a/R/check-mac.R b/R/check-mac.R index 90b82a132..3346775d2 100644 --- a/R/check-mac.R +++ b/R/check-mac.R @@ -40,6 +40,7 @@ check_mac_release <- function(pkg = ".", dep_pkgs = character(), args = NULL, ma url <- "https://mac.r-project.org/macbuilder/v1/submit" + rlang::check_installed("httr") body <- list(pkgfile = httr::upload_file(built_path)) if (length(dep_built_paths) > 0) { diff --git a/R/release.R b/R/release.R index 6a62a3cfe..352c5886b 100644 --- a/R/release.R +++ b/R/release.R @@ -277,6 +277,7 @@ upload_cran <- function(pkg, built_path, call = parent.frame()) { # Initial upload --------- cli::cli_inform(c(i = "Uploading package & comments")) + rlang::check_installed("httr") body <- list( pkg_id = "", name = maint$name, diff --git a/R/run-source.R b/R/run-source.R index b3a0ca317..3c8ac9ae4 100644 --- a/R/run-source.R +++ b/R/run-source.R @@ -31,6 +31,7 @@ source_url <- function(url, ..., sha1 = NULL) { stopifnot(is.character(url), length(url) == 1) rlang::check_installed("digest") + rlang::check_installed("httr") temp_file <- file_temp() on.exit(file_delete(temp_file), add = TRUE) From 347bad8a13ea37a60b9534b9437f7c6a49d19642 Mon Sep 17 00:00:00 2001 From: Jenny Bryan Date: Mon, 29 Jul 2024 07:30:01 -0700 Subject: [PATCH 2/2] Tweak NEWS --- NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 4ba5ce6c7..c67e0bc1c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ # devtools (development version) -* Use `httr` package conditionally with `rlang::check_installed("httr")` - (#2573). +* Functions that use httr now explicitly check that it is installed + (@catalamarti, #2573). * `test_coverage()` now works if the package has not been installed.