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


##########
r/tools/winlibs.R:
##########
@@ -18,69 +18,79 @@
 args <- commandArgs(TRUE)
 VERSION <- args[1]
 dev_version <- package_version(VERSION)[1, 4]
-# Small dev versions are added for R-only changes during CRAN submission.
+# Small dev versions are added for R-only changes during CRAN submission
 is_release <- is.na(dev_version) || dev_version < "100"
 env_is <- function(var, value) identical(tolower(Sys.getenv(var)), value)
+# We want to log the message in the style of the configure script
+# not as an R error but still stop evaluation of this script.
+lg <- function(...) {
+  cat("*** ", sprintf(...), "\n")
+}
+exit <- function(...) {
+  lg(...)
+  return()
+}
 
-if (!file.exists(sprintf("windows/arrow-%s/include/arrow/api.h", VERSION))) {
-  if (length(args) > 1) {
-    # Arg 2 would be the path/to/lib.zip
-    localfile <- args[2]
-    cat(sprintf("*** Using RWINLIB_LOCAL %s\n", localfile))
-    if (!file.exists(localfile)) {
-      cat(sprintf("*** %s does not exist; build will fail\n", localfile))
-    }
-    zip_file <- "lib.zip"
-    file.copy(localfile, zip_file)
-  } else {
-    # Download static arrow from the apache artifactory
-    quietly <- !identical(tolower(Sys.getenv("ARROW_R_DEV")), "true")
-    get_file <- function(template, version, dest_file) {
-      try(
-        suppressWarnings(
-          download.file(sprintf(template, version), dest_file, quiet = quietly)
-        ),
-        silent = quietly
-      )
-    }
+if (is_release) {
+  # This is a release version, so we need to use the major.minor.patch version 
without
+  # the CRAN suffix/dev_version
+  VERSION <- package_version(VERSION)[1, 1:3]
+  # %1$s uses the first variable for both substitutions
+  url_template <- paste0(
+    getOption("arrow.repo", 
"https://apache.jfrog.io/artifactory/arrow/r/%1$s";),
+    "/libarrow/bin/windows/arrow-%1$s.zip"
+  )
+} else {
+  url_template <- paste0(
+    getOption("arrow.dev_repo", "https://nightlies.apache.org/arrow/r";),
+    "/libarrow/bin/windows/arrow-%s.zip"
+  )
+}
 
-    # URL templates
-    nightly <- paste0(
-      getOption("arrow.dev_repo", "https://nightlies.apache.org/arrow/r";),
-      "/libarrow/bin/windows/arrow-%s.zip"
-    )
-    # %1$s uses the first variable for both substitutions
-    artifactory <- paste0(
-      getOption("arrow.repo", 
"https://apache.jfrog.io/artifactory/arrow/r/%1$s";),
-      "/libarrow/bin/windows/arrow-%1$s.zip"
-    )
+if (file.exists(sprintf("windows/arrow-%s/include/arrow/api.h", VERSION))) {

Review Comment:
   This was previously before the truncation of the version string so 
theoretically having a local 13.0.0 version of arrow would not have worked  
with package 13.0.0.1. Likely never happened but still ^^



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