Skip to content

Commit f196f14

Browse files
committed
ensure fake func. entry not left in NAMESPACE and exportPattern set
1 parent 79565f9 commit f196f14

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2020-06-05 Dirk Eddelbuettel <[email protected]>
2+
3+
* R/Rcpp.package.skeleton.R: Remove a remaining NAMESPACE entry for
4+
a temporary function symbol; ensure an exportPattern is set
5+
16
2020-05-18 Dirk Eddelbuettel <[email protected]>
27

38
* DESCRIPTION (Version, Date): Roll minor version

R/Rcpp.package.skeleton.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2009 - 2019 Dirk Eddelbuettel and Romain Francois
1+
# Copyright (C) 2009 - 2020 Dirk Eddelbuettel and Romain Francois
22
#
33
# This file is part of Rcpp.
44
#
@@ -28,7 +28,6 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
2828

2929
havePkgKitten <- requireNamespace("pkgKitten", quietly=TRUE)
3030

31-
3231
call <- match.call()
3332
call[[1]] <- as.name("package.skeleton")
3433
env <- parent.frame(1)
@@ -116,6 +115,9 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
116115
writeLines('importFrom(Rcpp, evalCpp)', ns)
117116
message(" >> added importFrom(Rcpp, evalCpp) directive to NAMESPACE" )
118117
}
118+
if (!any(grepl("^exportPattern", lines))) {
119+
writeLines("exportPattern(\"^[[:alpha:]]+\")", ns)
120+
}
119121
close( ns )
120122

121123
## update the package description help page
@@ -206,6 +208,11 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(),
206208
rm("Rcpp.fake.fun", envir = env)
207209
unlink(file.path(root, "R" , "Rcpp.fake.fun.R"))
208210
unlink(file.path(root, "man", "Rcpp.fake.fun.Rd"))
211+
212+
## cleansing NAMESPACE of fake function entry
213+
lines <- readLines(NAMESPACE)
214+
lines <- lines[!grepl("^export.*fake\\.fun", lines)]
215+
writeLines(lines, NAMESPACE)
209216
}
210217

211218
if (isTRUE(remove_hello_world)) {

0 commit comments

Comments
 (0)