From cd220c91a9d456ce2a1c8141050d8c1177a635cb Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Tue, 31 Mar 2020 15:27:19 -0700 Subject: [PATCH 1/2] avoid including empty string in R CMD SHLIB call --- ChangeLog | 3 +++ R/Attributes.R | 27 +++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9fcf8e44..e1583e4b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2020-03-31 Dirk Eddelbuettel * docker/ci-dev/Dockerfile: Also install the 'codetools' package +2020-03-31 Kevin Ushey + + * R/Attributes.R: Fix for sourceCpp() on Windows w/R-devel 2020-03-24 Dirk Eddelbuettel diff --git a/R/Attributes.R b/R/Attributes.R index 184ac3a0e..a4bd76dbd 100644 --- a/R/Attributes.R +++ b/R/Attributes.R @@ -127,17 +127,24 @@ sourceCpp <- function(file = "", file.remove(context$previousDynlibPath) } # #nocov end + # grab components we need to build command + r <- paste(R.home("bin"), "R", sep = .Platform$file.sep) + lib <- context$dynlibFilename + deps <- context$cppDependencySourcePaths + src <- context$cppSourceFilename + # prepare the command (output if we are in showOutput mode) - cmd <- paste(R.home(component="bin"), .Platform$file.sep, "R ", - "CMD SHLIB ", - ifelse(windowsDebugDLL, "-d ", ""), - "-o ", shQuote(context$dynlibFilename), " ", - ifelse(rebuild, "--preclean ", ""), - ifelse(dryRun, "--dry-run ", ""), - paste(shQuote(context$cppDependencySourcePaths), - collapse = " "), " ", - shQuote(context$cppSourceFilename), " ", - sep="") + cmd <- paste( + r, "CMD", "SHLIB", + if (windowsDebugDLL) "-d", + if (rebuild) "--preclean", + if (dryRun) "--dry-run", + "-o", shQuote(lib), + if (length(deps)) + paste(shQuote(deps), collapse = " "), + shQuote(src) + ) + if (showOutput) cat(cmd, "\n") # #nocov From 82e151a855c56d5b238f1873615139584623c31f Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Tue, 31 Mar 2020 15:40:07 -0700 Subject: [PATCH 2/2] avoid extraneous white-space in command --- ChangeLog | 3 ++- R/Attributes.R | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e1583e4b7..c345e6dad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2020-03-31 Dirk Eddelbuettel * docker/ci-dev/Dockerfile: Also install the 'codetools' package -2020-03-31 Kevin Ushey + +2020-03-31 Kevin Ushey * R/Attributes.R: Fix for sourceCpp() on Windows w/R-devel diff --git a/R/Attributes.R b/R/Attributes.R index a4bd76dbd..33304c83a 100644 --- a/R/Attributes.R +++ b/R/Attributes.R @@ -134,7 +134,7 @@ sourceCpp <- function(file = "", src <- context$cppSourceFilename # prepare the command (output if we are in showOutput mode) - cmd <- paste( + args <- c( r, "CMD", "SHLIB", if (windowsDebugDLL) "-d", if (rebuild) "--preclean", @@ -145,6 +145,7 @@ sourceCpp <- function(file = "", shQuote(src) ) + cmd <- paste(args, collapse = " ") if (showOutput) cat(cmd, "\n") # #nocov