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/12 18:55:54 UTC

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

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


##########
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:
   Do we need `skip_download` outside of testing? What might be better is to temporarily override `system2` within the test to always return 0 and do nothing. That would also avoid the issue of the error on missing wget in the test environment.



-- 
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