Skip to content

Commit 00a4477

Browse files
committed
deprecate namespace argument in Rcpp.package.skeleton
1 parent 9261bae commit 00a4477

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2013-10-16 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Deprecate
4+
namespace argument which package.skeleton() no longer uses
5+
* man/Rcpp.package.skeleton.Rd: Updated documentation accordingly
6+
17
2013-10-16 Romain Francois <romain@r-enthusiasts.com>
28

39
* include/Rcpp/api/meat/is.h : added missing implementation for

R/Rcpp.package.skeleton.R

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- tab-width: 4; -*-
22

3-
# Copyright (C) 2009 - 2012 Dirk Eddelbuettel and Romain Francois
3+
# Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
44
#
55
# This file is part of Rcpp.
66
#
@@ -17,20 +17,17 @@
1717
# You should have received a copy of the GNU General Public License
1818
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1919

20-
Rcpp.package.skeleton <- function(
21-
name = "anRpackage", list = character(), environment = .GlobalEnv,
22-
path = ".", force = FALSE, namespace = TRUE,
23-
code_files = character(), cpp_files = character(),
24-
example_code = TRUE,
25-
attributes = TRUE,
26-
module = FALSE,
27-
author = "Who wrote it",
28-
maintainer = if(missing( author)) "Who to complain to" else author,
29-
email = "yourfault@somewhere.net",
30-
license = "What Licence is it under ?"
31-
){
32-
33-
if (!is.character(cpp_files))
20+
Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
21+
environment = .GlobalEnv,
22+
path = ".", force = FALSE,
23+
code_files = character(), cpp_files = character(),
24+
example_code = TRUE, attributes = TRUE, module = FALSE,
25+
author = "Who wrote it",
26+
maintainer = if(missing( author)) "Who to complain to" else author,
27+
email = "yourfault@somewhere.net",
28+
license = "What Licence is it under ?") {
29+
30+
if (!is.character(cpp_files))
3431
stop("'cpp_files' must be a character vector")
3532
# set example_code if attributes is set
3633
if( isTRUE(attributes) )
@@ -40,7 +37,7 @@ Rcpp.package.skeleton <- function(
4037
if( !length(list) ){
4138
fake <- TRUE
4239
assign( "Rcpp.fake.fun", function(){}, envir = env )
43-
if( example_code && !isTRUE(attributes)){
40+
if( example_code && !isTRUE(attributes)){
4441
assign( "rcpp_hello_world", function(){}, envir = env )
4542
remove_hello_world <- TRUE
4643
} else {
@@ -59,7 +56,6 @@ Rcpp.package.skeleton <- function(
5956
# first let the traditional version do its business
6057
call <- match.call()
6158
call[[1]] <- as.name("package.skeleton")
62-
call[["namespace"]] <- namespace
6359
# remove Rcpp specific arguments
6460

6561
call <- call[ c( 1L, which( names(call) %in% names(formals(package.skeleton)))) ]
@@ -117,15 +113,15 @@ Rcpp.package.skeleton <- function(
117113
}
118114
close( ns )
119115
}
120-
116+
121117
# update the package description help page
122118
package_help_page <- file.path( root, "man", sprintf( "%s-package.Rd", name ) )
123119
if( file.exists(package_help_page) ){
124120
lines <- readLines(package_help_page)
125121
lines <- gsub( "What license is it under?", license, lines, fixed = TRUE )
126-
lines <- gsub( "Who to complain to <yourfault@somewhere.net>",
127-
sprintf( "%s <%s>", maintainer, email),
128-
lines,
122+
lines <- gsub( "Who to complain to <yourfault@somewhere.net>",
123+
sprintf( "%s <%s>", maintainer, email),
124+
lines,
129125
fixed = TRUE
130126
)
131127
lines <- gsub( "Who wrote it", author, lines, fixed = TRUE )
@@ -149,18 +145,18 @@ Rcpp.package.skeleton <- function(
149145
file.copy( file.path( skeleton, "Makevars.win" ), Makevars.win )
150146
message( " >> added Makevars.win file with Rcpp settings" )
151147
}
152-
148+
153149
if ( length(cpp_files) > 0L ) {
154150
for (file in cpp_files) {
155151
file.copy(file, src)
156152
message( " >> copied ", file, " to src directory" )
157153
}
158154
compileAttributes(root)
159155
}
160-
156+
161157
if( example_code ){
162158
if ( isTRUE( attributes ) ) {
163-
file.copy( file.path( skeleton, "rcpp_hello_world_attributes.cpp" ),
159+
file.copy( file.path( skeleton, "rcpp_hello_world_attributes.cpp" ),
164160
file.path( src, "rcpp_hello_world.cpp" ) )
165161
message( " >> added example src file using Rcpp attributes")
166162
compileAttributes(root)
@@ -170,16 +166,16 @@ Rcpp.package.skeleton <- function(
170166
header <- gsub( "@PKG@", name, header, fixed = TRUE )
171167
writeLines( header , file.path( src, "rcpp_hello_world.h" ) )
172168
message( " >> added example header file using Rcpp classes")
173-
169+
174170
file.copy( file.path( skeleton, "rcpp_hello_world.cpp" ), src )
175171
message( " >> added example src file using Rcpp classes")
176-
172+
177173
rcode <- readLines( file.path( skeleton, "rcpp_hello_world.R" ) )
178174
rcode <- gsub( "@PKG@", name, rcode, fixed = TRUE )
179175
writeLines( rcode , file.path( root, "R", "rcpp_hello_world.R" ) )
180176
message( " >> added example R file calling the C++ example")
181177
}
182-
178+
183179
hello.Rd <- file.path( root, "man", "rcpp_hello_world.Rd")
184180
unlink( hello.Rd )
185181
file.copy(

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
\itemize{
2121
\item Export linking helper function \code{LdFlags} as well as
2222
\code{RcppLdFlags}.
23+
\item Function \code{Rcpp.package.skeleton()} no longer passes a
24+
\code{namespace} argument on to \code{package.skeleton()}
2325
}
2426
\item Changes in R setup:
2527
\itemize{

man/Rcpp.package.skeleton.Rd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Create a skeleton for a new package depending on Rcpp
1313
\usage{
1414
Rcpp.package.skeleton(name = "anRpackage", list = character(),
1515
environment = .GlobalEnv, path = ".", force = FALSE,
16-
namespace = TRUE, code_files = character(), cpp_files = character(),
16+
code_files = character(), cpp_files = character(),
1717
example_code = TRUE, attributes = TRUE, module = FALSE,
1818
author = "Who wrote it",
1919
maintainer = if(missing( author)) "Who to complain to" else author,
@@ -27,7 +27,6 @@ Rcpp.package.skeleton(name = "anRpackage", list = character(),
2727
\item{environment}{See \link[utils]{package.skeleton}}
2828
\item{path}{See \link[utils]{package.skeleton}}
2929
\item{force}{See \link[utils]{package.skeleton}}
30-
\item{namespace}{See \link[utils]{package.skeleton}}
3130
\item{code_files}{See \link[utils]{package.skeleton}}
3231
\item{cpp_files}{A character vector with the paths to C++ source files to add to the package. }
3332
\item{example_code}{If TRUE, example c++ code using Rcpp is added to the package. }

0 commit comments

Comments
 (0)