assignUser commented on code in PR #38236:
URL: https://github.com/apache/arrow/pull/38236#discussion_r1363095267


##########
r/tools/nixlibs.R:
##########
@@ -811,22 +802,90 @@ cmake_find_package <- function(pkg, version = NULL, 
env_var_list) {
   system(cmake_cmd, ignore.stdout = TRUE, ignore.stderr = TRUE) == 0
 }
 
-#####
+############### Main logic #############
+args <- commandArgs(TRUE)
+VERSION <- args[1]
+
+# TESTING is set in test-nixlibs.R; it won't be set when called from configure
+test_mode <- exists("TESTING")
+
+# Prevent error with binary selection during testing.
+if (test_mode && is.na(VERSION)) {
+  VERSION <- "8.0.0.9000"
+}
+
+VERSION <- package_version(VERSION)
+dev_version <- VERSION[1, 4]
+# Small dev versions are added for R-only changes during CRAN submission
+is_release <- is.na(dev_version) || dev_version < "100"
+
+on_macos <- tolower(Sys.info()[["sysname"]]) == "darwin"
+on_windows <- tolower(Sys.info()[["sysname"]]) == "windows"
+
+# For local debugging, set ARROW_R_DEV=TRUE to make this script print more
+quietly <- !env_is("ARROW_R_DEV", "true")
+
+not_cran <- env_is("NOT_CRAN", "true")
+
+if (is_release) {
+  VERSION <- VERSION[1, 1:3]
+  arrow_repo <- paste0(getOption("arrow.repo", 
sprintf("https://apache.jfrog.io/artifactory/arrow/r/%s";, VERSION)), 
"/libarrow/")
+} else {
+  not_cran <- TRUE
+  arrow_repo <- paste0(getOption("arrow.dev_repo", 
"https://nightlies.apache.org/arrow/r";), "/libarrow/")
+  VERSION <- find_latest_nightly(VERSION)
+}
+
+options(.arrow.cleanup = character()) # To collect dirs to rm on exit

Review Comment:
   I only moved this, ~~and as far as I can see it's not actually being used in 
the script (a relic from the past?).~~  I would prefer the more direct 
`on.exit(unlink(` approach in the few cases where we need it, unless there  are 
functional reasons that would make that fail? The direct approach is also 
shorter?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to