-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend Rcpp.package.skeleton to support URL and BugReports (#1358)
Also flips default package version to a saner '0.0.1'
- Loading branch information
1 parent
d854744
commit 50d8ad7
Showing
6 changed files
with
64 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
2025-02-11 Dirk Eddelbuettel <[email protected]> | ||
|
||
* R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Support optional | ||
argument 'github_user' to populate URL and BugReports if given | ||
* man/Rcpp.package.skeleton.Rd: Document new optional argument | ||
|
||
* R/Rcpp.package.skeleton.R (Rcpp.package.skeleton): Default version | ||
is now '0.0.1' and not '1.0' | ||
* inst/tinytest/test_rcpp_package_skeleton.R: Adjust test accordingly | ||
* inst/tinytest/test_expose_class.R: Idem | ||
|
||
2025-02-05 Dirk Eddelbuettel <[email protected]> | ||
|
||
* DESCRIPTION (Version, Date): Roll micro version and date | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (C) 2009 - 2021 Dirk Eddelbuettel and Romain Francois | ||
# Copyright (C) 2009 - 2025 Dirk Eddelbuettel and Romain Francois | ||
# | ||
# This file is part of Rcpp. | ||
# | ||
|
@@ -24,6 +24,7 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(), | |
maintainer = if (missing(author)) "Your Name" | ||
else author, | ||
email = "[email protected]", | ||
githubuser = NA_character_, | ||
license = "GPL (>= 2)") { | ||
|
||
havePkgKitten <- requireNamespace("pkgKitten", quietly=TRUE) | ||
|
@@ -90,18 +91,26 @@ Rcpp.package.skeleton <- function(name = "anRpackage", list = character(), | |
paste(splitname[-length(splitname)], collapse=" "), | ||
splitname[length(splitname)], | ||
email)) | ||
#x[, "Author"] <- author | ||
#x[, "Maintainer"] <- sprintf("%s <%s>", maintainer, email) | ||
fields_written <- c("Package", "Type", "Title", "Version", "Date", | ||
"Authors@R", "Description", "License", "Imports", "LinkingTo") | ||
if (!is.na(githubuser)) { | ||
x <- cbind(x, matrix("", 1, 1, dimnames=list("", "URL"))) | ||
x[1, "URL"] <- paste0("https://github.com/", githubuser, "/", name) | ||
x <- cbind(x, matrix("", 1, 1, dimnames=list("", "BugReports"))) | ||
x[1, "BugReports"] <- paste0("https://github.com/", githubuser, "/", name, "/issues") | ||
|
||
fields_written <- c("Package", "Type", "Title", "Version", "Date", | ||
"Authors@R", "Description", "URL", "BugReports", | ||
"License", "Imports", "LinkingTo") | ||
} | ||
|
||
x[, "License"] <- license | ||
x[, "Title"] <- "Concise Summary of What the Package Does" | ||
x[, "Description"] <- "More about what it does (maybe more than one line)." | ||
x[, "Version"] <- "0.0.1" | ||
message( " >> added Imports: Rcpp" ) | ||
message( " >> added LinkingTo: Rcpp" ) | ||
write.dcf(x, file = DESCRIPTION) | ||
write.dcf(x[1, c("Package", "Type", "Title", "Version", "Date", | ||
"Authors@R", "Description", "License", "Imports", "LinkingTo"), | ||
drop = FALSE], | ||
file = DESCRIPTION) | ||
write.dcf(x[1, fields_written, drop = FALSE], file = DESCRIPTION) | ||
} | ||
|
||
## add useDynLib and importFrom to NAMESPACE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,20 +4,20 @@ | |
Create a skeleton for a new package depending on Rcpp | ||
} | ||
\description{ | ||
\code{Rcpp.package.skeleton} automates the creation of | ||
a new source package that intends to use features of Rcpp. | ||
\code{Rcpp.package.skeleton} automates the creation of | ||
a new source package that intends to use features of Rcpp. | ||
|
||
It is based on the \link[utils]{package.skeleton} function | ||
which it executes first. | ||
} | ||
\usage{ | ||
Rcpp.package.skeleton(name = "anRpackage", list = character(), | ||
environment = .GlobalEnv, path = ".", force = FALSE, | ||
Rcpp.package.skeleton(name = "anRpackage", list = character(), | ||
environment = .GlobalEnv, path = ".", force = FALSE, | ||
code_files = character(), cpp_files = character(), | ||
example_code = TRUE, attributes = TRUE, module = FALSE, | ||
author = "Your Name", | ||
maintainer = if(missing( author)) "Your Name" else author, | ||
email = "[email protected]", | ||
example_code = TRUE, attributes = TRUE, module = FALSE, | ||
author = "Your Name", | ||
maintainer = if(missing( author)) "Your Name" else author, | ||
email = "[email protected]", githubuser = NA_character_, | ||
license = "GPL (>= 2)" | ||
) | ||
} | ||
|
@@ -35,42 +35,43 @@ Rcpp.package.skeleton(name = "anRpackage", list = character(), | |
\item{author}{Author of the package.} | ||
\item{maintainer}{Maintainer of the package.} | ||
\item{email}{Email of the package maintainer.} | ||
\item{githubuser}{GitHub username for URL and BugReports, if present.} | ||
\item{license}{License of the package.} | ||
} | ||
\details{ | ||
In addition to \link[utils]{package.skeleton} : | ||
The \samp{DESCRIPTION} file gains an Imports line requesting that | ||
In addition to \link[utils]{package.skeleton} : | ||
|
||
The \samp{DESCRIPTION} file gains an Imports line requesting that | ||
the package depends on Rcpp and a LinkingTo line so that the package | ||
finds Rcpp header files. | ||
|
||
The \samp{NAMESPACE} gains a \code{useDynLib} directive as well | ||
as an \code{importFrom(Rcpp, evalCpp} to ensure instantiation of Rcpp. | ||
The \samp{src} directory is created if it does not exists. | ||
|
||
The \samp{src} directory is created if it does not exists. | ||
|
||
If \code{cpp_files} are provided then they will be copied to the \samp{src} | ||
directory. | ||
If the \code{example_code} argument is set to \code{TRUE}, | ||
|
||
If the \code{example_code} argument is set to \code{TRUE}, | ||
example files \samp{rcpp_hello_world.h} and \samp{rcpp_hello_world.cpp} | ||
are also created in the \samp{src}. An R file \samp{rcpp_hello_world.R} is | ||
are also created in the \samp{src}. An R file \samp{rcpp_hello_world.R} is | ||
expanded in the \samp{R} directory, the \code{rcpp_hello_world} function | ||
defined in this files makes use of the C++ function \samp{rcpp_hello_world} | ||
defined in the C++ file. These files are given as an example and should | ||
defined in the C++ file. These files are given as an example and should | ||
eventually by removed from the generated package. | ||
|
||
If the \code{attributes} argument is \code{TRUE}, then rather than generate | ||
the example files as described above, a single \samp{rcpp_hello_world.cpp} | ||
file is created in the \samp{src} directory and it's attributes are | ||
compiled using the \code{\link{compileAttributes}} function. This leads to | ||
file is created in the \samp{src} directory and it's attributes are | ||
compiled using the \code{\link{compileAttributes}} function. This leads to | ||
the files \samp{RcppExports.R} and \samp{RcppExports.cpp} being generated. | ||
They are automatically regenerated from \emph{scratch} each time | ||
\code{\link{compileAttributes}} is called. Therefore, one should | ||
They are automatically regenerated from \emph{scratch} each time | ||
\code{\link{compileAttributes}} is called. Therefore, one should | ||
\strong{not} modify by hand either of the \samp{RcppExports} files. | ||
If the \code{module} argument is \code{TRUE}, a sample Rcpp module will | ||
be generated as well. | ||
If the \code{module} argument is \code{TRUE}, a sample Rcpp module will | ||
be generated as well. | ||
} | ||
\value{ | ||
Nothing, used for its side effects | ||
|
@@ -105,4 +106,3 @@ vignette( "Rcpp-modules" ) | |
} | ||
} | ||
\keyword{ programming } | ||