[Rcpp-commits] r4322 - in pkg/Rcpp: . R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 24 23:53:33 CEST 2013


Author: jjallaire
Date: 2013-05-24 23:53:33 +0200 (Fri, 24 May 2013)
New Revision: 4322

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Attributes.R
   pkg/Rcpp/inst/NEWS.Rd
Log:
Disallow compilation for files that don't have extensions supported by R CMD SHLIB

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-05-21 10:36:04 UTC (rev 4321)
+++ pkg/Rcpp/ChangeLog	2013-05-24 21:53:33 UTC (rev 4322)
@@ -1,3 +1,8 @@
+2013-05-24  J.J. Allaire <jj at rstudio.org>
+
+        * R/Attributes.R: Disallow compilation for files that don't have
+        extensions supported by R CMD SHLIB
+
 2013-05-21  J.J. Allaire <jj at rstudio.org>
 
         * R/Attributes.R: Lookup plugins in inline package if they aren't

Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R	2013-05-21 10:36:04 UTC (rev 4321)
+++ pkg/Rcpp/R/Attributes.R	2013-05-24 21:53:33 UTC (rev 4322)
@@ -35,6 +35,12 @@
     # resolve the file path
     file <- normalizePath(file, winslash = "/")
     
+    # error if the file extension isn't one supported by R CMD SHLIB
+    if (! tools::file_ext(file) %in% c("cc", "cpp")) {
+        stop("The filename '", basename(file), "' does not have an ",
+             "extension of .cc or .cpp so cannot be compiled.")
+    }
+
     # validate that there are no spaces in the path on windows
     if (.Platform$OS.type == "windows") {
         if (grepl(' ', basename(file), fixed=TRUE)) {

Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd	2013-05-21 10:36:04 UTC (rev 4321)
+++ pkg/Rcpp/inst/NEWS.Rd	2013-05-24 21:53:33 UTC (rev 4322)
@@ -13,6 +13,8 @@
       header files.
       \item Lookup plugins in \pkg{inline} package if they aren't found
       within the \pkg{Rcpp} package.
+      \item Disallow compilation for files that don't have extensions 
+      supported by R CMD SHLIB
     }
     \item Changes in Rcpp API:
     \itemize{



More information about the Rcpp-commits mailing list