You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/13 01:10:43 UTC

[GitHub] [arrow] karldw commented on a diff in pull request #12849: ARROW-15092: [R] Support create_package_with_all_dependencies() on non-linux systems

karldw commented on code in PR #12849:
URL: https://github.com/apache/arrow/pull/12849#discussion_r848986139


##########
r/R/install-arrow.R:
##########
@@ -137,6 +137,54 @@ reload_arrow <- function() {
   }
 }
 
+#' Run download script
+#'
+#' @param tools_dir The `tools/` directory in the package.
+#' @param skip_download Skip doing the actual download?
+#' Note: we only need bash and wget here, not a full compiler suite.
+#' These will often be missing on Windows, but are typically present on other
+#' systems.
+#' @noRd
+run_download_script <- function(tools_dir, skip_download = FALSE) {
+  if (.Platform$OS.type == "windows") {
+    if (!requireNamespace("pkgbuild", quietly = TRUE)) {
+      stop("pkgbuild is required on Windows")
+    }
+    if (!pkgbuild::has_build_tools()) {
+      stop("This script requires bash and wget. Please install Rtools or run this in WSL.")
+    }
+    # Have build tools available for the rest of this function
+    pkgbuild::local_build_tools()
+  }
+  suppressWarnings(
+    is_wget_available <- system2(
+      "bash", c("-c", "'wget -V'"),
+      stdout = FALSE, stderr = FALSE
+    ) == 0
+  )
+  if (!is_wget_available) {
+    stop("Can't run wget - will not be able to download files")
+  }
+  bash_file <- file.path(tools_dir, "cpp/thirdparty/download_dependencies.sh")
+  if (!file.exists(bash_file)) {
+    stop("Can't find expected download_dependencies.sh file.")
+  }
+  # If you change this path, also need to edit nixlibs.R
+  download_dir <- file.path(tools_dir, "thirdparty_dependencies")
+  dir.create(download_dir)
+
+  if (!skip_download) {

Review Comment:
   We don't need `skip_download` outside of testing. Do you mean temporarily redefining the `system2` function? That seems like it could lead to some hard-to-diagnose bugs if a future reader is expecting `base::system2` when they see `system2`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org