Skip to content

Commit 9a9626e

Browse files
authored
Merge pull request #77 from RcppCore/feature/skeleton_fix
Feature/skeleton fix
2 parents c3891e5 + c747e48 commit 9a9626e

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2019-10-13 Dirk Eddelbuettel <edd@debian.org>
2+
3+
* DESCRIPTION (Version, Date): Roll minor version
4+
5+
* R/RcppEigen.package.skeleton.R (RcppEigen.package.skeleton): Move
6+
test for example_code outside of haveKitten test
7+
18
2019-05-24 Dirk Eddelbuettel <edd@debian.org>
29

310
* vignettes/RcppEigen-Introduction.Rnw: Update vignette to use

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: RcppEigen
22
Type: Package
33
Title: 'Rcpp' Integration for the 'Eigen' Templated Linear Algebra Library
4-
Version: 0.3.3.5.0
5-
Date: 2018-11-24
4+
Version: 0.3.3.5.1
5+
Date: 2019-10-13
66
Author: Douglas Bates, Dirk Eddelbuettel, Romain Francois, and Yixuan Qiu;
77
the authors of Eigen for the included version of Eigen
88
Maintainer: Dirk Eddelbuettel <edd@debian.org>

R/RcppEigen.package.skeleton.R

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## RcppEigen.package.skeleton.R: makes a skeleton for a package that wants to use RcppEigen
22
##
3-
## Copyright (C) 2011 - 2015 Douglas Bates, Dirk Eddelbuettel and Romain Francois
3+
## Copyright (C) 2011 - 2019 Douglas Bates, Dirk Eddelbuettel and Romain Francois
44
##
55
## This file is part of RcppEigen.
66
##
@@ -19,12 +19,12 @@
1919

2020
RcppEigen.package.skeleton <- function(name= "anRpackage", list = character(),
2121
environment = .GlobalEnv,
22-
path = ".", force = FALSE,
23-
code_files = character(),
22+
path = ".", force = FALSE,
23+
code_files = character(),
2424
example_code = TRUE) {
25-
25+
2626
env <- parent.frame(1)
27-
27+
2828
if (!length(list)) {
2929
fake <- TRUE
3030
assign("Rcpp.fake.fun", function() {}, envir = env)
@@ -40,39 +40,39 @@ RcppEigen.package.skeleton <- function(name= "anRpackage", list = character(),
4040
## first let the traditional version do its business
4141
call <- match.call()
4242
call[[1]] <- skelFunUsed
43+
if ("example_code" %in% names(call)) {
44+
call[["example_code"]] <- NULL # remove the example_code argument
45+
}
4346
if (! haveKitten) { # in the package.skeleton() case
44-
if ("example_code" %in% names(call)) {
45-
call[["example_code"]] <- NULL # remove the example_code argument
46-
}
4747
if (fake) {
4848
call[["list"]] <- "Rcpp.fake.fun"
4949
}
5050
}
51-
51+
5252
tryCatch(eval(call, envir = env),
5353
error = function(e) {
5454
cat(paste(e, "\n")) # print error
5555
stop(paste("error while calling `", skelFunName, "`", sep=""))
5656
})
57-
57+
5858
message("\nAdding RcppEigen settings")
59-
60-
## now pick things up
59+
60+
## now pick things up
6161
root <- file.path(path, name)
62-
62+
6363
## Add Rcpp to the DESCRIPTION
6464
DESCRIPTION <- file.path(root, "DESCRIPTION")
6565
if (file.exists(DESCRIPTION)) {
66-
x <- cbind(read.dcf(DESCRIPTION),
67-
"Imports" = sprintf("Rcpp (>= %s)",
68-
packageDescription("Rcpp")[["Version"]]),
66+
x <- cbind(read.dcf(DESCRIPTION),
67+
"Imports" = sprintf("Rcpp (>= %s)",
68+
packageDescription("Rcpp")[["Version"]]),
6969
"LinkingTo" = "Rcpp, RcppEigen")
7070
write.dcf(x, file = DESCRIPTION)
7171
message(" >> added Imports: Rcpp")
7272
message(" >> added LinkingTo: Rcpp, RcppEigen")
7373
}
74-
75-
## add a useDynLib to NAMESPACE,
74+
75+
## add a useDynLib to NAMESPACE,
7676
NAMESPACE <- file.path(root, "NAMESPACE")
7777
lines <- readLines(NAMESPACE)
7878
if (! grepl("useDynLib", lines)) {
@@ -83,7 +83,7 @@ RcppEigen.package.skeleton <- function(name= "anRpackage", list = character(),
8383
writeLines(lines, con = NAMESPACE)
8484
message(" >> added useDynLib and importFrom directives to NAMESPACE")
8585
}
86-
86+
8787
## lay things out in the src directory
8888
src <- file.path(root, "src")
8989
if (!file.exists(src)) {
@@ -99,13 +99,13 @@ RcppEigen.package.skeleton <- function(name= "anRpackage", list = character(),
9999
file.copy(file.path(skeleton, "Makevars"), Makevars)
100100
message(" >> added Makevars file with RcppEigen settings")
101101
}
102-
102+
103103
Makevars.win <- file.path(src, "Makevars.win")
104104
if (!file.exists(Makevars.win)) {
105105
file.copy(file.path(skeleton, "Makevars.win"), Makevars.win)
106106
message(" >> added Makevars.win file with RcppEigen settings")
107107
}
108-
108+
109109
if (example_code) {
110110
file.copy(file.path(skeleton, "rcppeigen_hello_world.cpp"), src)
111111
message(" >> added example src file using Eigen classes")
@@ -115,13 +115,12 @@ RcppEigen.package.skeleton <- function(name= "anRpackage", list = character(),
115115
Rcpp::compileAttributes(root)
116116
message(" >> invoked Rcpp::compileAttributes to create wrappers")
117117
}
118-
118+
119119
if (fake) {
120120
rm("Rcpp.fake.fun", envir = env)
121121
unlink(file.path(root, "R" , "Rcpp.fake.fun.R"))
122122
unlink(file.path(root, "man", "Rcpp.fake.fun.Rd"))
123123
}
124-
124+
125125
invisible(NULL)
126126
}
127-

inst/NEWS.Rd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
\item Small RNG use update to first example in skeleton package used
1111
by package creation helper.
1212
\item Update vignette example to use RcppEigen:::eigen_version().
13+
\item Correct one RcppEigen.package.skeleton() corner case.
1314
}
1415
}
1516

0 commit comments

Comments
 (0)