diff --git a/ChangeLog b/ChangeLog index 750635f08..86208c983 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-12-02 Dirk Eddelbuettel + + * R/loadRcppModules.R: Remove file with function deprecated years ago + * man/loadRcppModules-deprecated.Rd: Idem + * NAMESPACE: Remove reference to loadRcppModules() + * man/loadModule.Rd: Idem + * man/Rcpp-deprecated.Rd: Idem + * vignettes/rmd/Rcpp-modules.Rmd: Idem + 2025-12-01 Kevin Ushey * R/Attributes.R: Update OpenMP plugin for macOS diff --git a/NAMESPACE b/NAMESPACE index 1af902e22..9f6fdf377 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,7 +16,6 @@ exportMethods(prompt, show, .DollarNames, initialize, "formals<-") export(Module, Rcpp.package.skeleton, populate, - loadRcppModules, # deprecated since Rcpp 0.12.5 released May 2016 setRcppClass, loadRcppClass, loadModule, diff --git a/R/loadRcppModules.R b/R/loadRcppModules.R deleted file mode 100644 index 844da8fc8..000000000 --- a/R/loadRcppModules.R +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) 2010 - 2016 John Chambers, Dirk Eddelbuettel and Romain Francois -# -# This file is part of Rcpp. -# -# Rcpp is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# Rcpp is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Rcpp. If not, see . - -loadRcppModules <- function(direct=TRUE) { # #nocov start - # deprecation added May 2016, 'loadModule' has been prefered for years - .Deprecated("loadModule") - - ## hunt for the namespace of the package that calls this - calls <- sys.calls() - w <- which( sapply( calls, function(call){ - identical( call[[1L]], as.name( "runHook" ) ) - } ) ) - if( !length(w) ) - stop( "loadRcppModules can only be used within a .onLoad function" ) - w <- w[ length(w) ] - call <- calls[[w]] - if( !identical( call[[2L]], ".onLoad" ) ) - stop( "loadRcppModules can only be used within a .onLoad function" ) - f <- sys.frame( w ) - ns <- get("env", f ) - if( !isNamespace( ns ) ) - stop( "loadRcppModules not called from a namespace" ) - pkg <- get( "pkgname", f ) - lib <- get( "libname", f ) - - ## look for declared modules in the DESCRIPTION fields - description <- packageDescription(pkg, lib.loc=lib) - modules <- description[["RcppModules"]] - if( !is.null( modules ) ){ - modules <- strsplit( modules, "[[:space:]]*,[[:space:]]*")[[1L]] - for( m in modules ){ - tryCatch( { - mod <- Module( m, pkg, mustStart = TRUE) - if(isTRUE(direct)){ - populate( mod, ns ) - } else { - forceAssignInNamespace( m, mod, ns ) - } - assign(.moduleMetaName(m), mod, envir = ns) - }, error = function(e){ - stop( sprintf( "failed to load module %s from package %s\n%s", m, pkg, conditionMessage(e) ) ) - }) - } - } -} # #nocov end diff --git a/inst/skeleton/zzz.R b/inst/skeleton/zzz.R index 0161cafed..a2e19a11a 100644 --- a/inst/skeleton/zzz.R +++ b/inst/skeleton/zzz.R @@ -1,16 +1,7 @@ -## Up until R 2.15.0, the require("methods") is needed but (now) -## triggers an warning from R CMD check -#.onLoad <- function(libname, pkgname){ -# #require("methods") ## needed with R <= 2.15.0 -# loadRcppModules() -#} - - -## For R 2.15.1 and later this also works. Note that calling loadModule() triggers +## For R 2.15.1 and later the approach shown here works (as opposed to the now removed +## and long-deprecated `loadRcppModules()`. Note that calling loadModule() triggers ## a load action, so this does not have to be placed in .onLoad() or evalqOnLoad(). loadModule("NumEx", TRUE) loadModule("yada", TRUE) loadModule("stdVector", TRUE) - - diff --git a/inst/tinytest/testRcppModule/R/zzz.R b/inst/tinytest/testRcppModule/R/zzz.R index f23b84272..e26fbae91 100644 --- a/inst/tinytest/testRcppModule/R/zzz.R +++ b/inst/tinytest/testRcppModule/R/zzz.R @@ -1,11 +1,6 @@ -# -#.onLoad <- function(libname, pkgname){ -# loadRcppModules() -#} - -## For R 2.15.1 and later this also works. Note that calling loadModule() triggers +## For R 2.15.1 and later the approach shown here works (as opposed to the now removed +## and long-deprecated `loadRcppModules()`. Note that calling loadModule() triggers ## a load action, so this does not have to be placed in .onLoad() or evalqOnLoad(). loadModule("RcppModuleNumEx", TRUE) loadModule("RcppModuleWorld", TRUE) loadModule("stdVector", TRUE) - diff --git a/man/Rcpp-deprecated.Rd b/man/Rcpp-deprecated.Rd index b2c8a763e..ddf287bbe 100644 --- a/man/Rcpp-deprecated.Rd +++ b/man/Rcpp-deprecated.Rd @@ -7,9 +7,6 @@ } \details{ \itemize{ - \item \code{\link{loadRcppModules}} calls should now be replaced by - \code{\link{loadModule}} calls, one per Module. - \item \code{\link{LdFlags}} and \code{\link{RcppLdFlags}} are no longer required as no library is provided (or needed) by Rcpp (as it was up until release 0.10.1). diff --git a/man/loadModule.Rd b/man/loadModule.Rd index 03102946d..c45cdb148 100644 --- a/man/loadModule.Rd +++ b/man/loadModule.Rd @@ -80,9 +80,6 @@ John Chambers } \seealso{ \code{\link{setRcppClass}()} to avoid the explicit call. - -\code{\link{loadRcppModules}()} for a (deprecated) shotgun procedure to load all -modules. } \examples{ \dontrun{ diff --git a/man/loadRcppModules-deprecated.Rd b/man/loadRcppModules-deprecated.Rd deleted file mode 100644 index 167efea9e..000000000 --- a/man/loadRcppModules-deprecated.Rd +++ /dev/null @@ -1,26 +0,0 @@ -\name{loadRcppModules-deprecated} -\alias{loadRcppModules} -\title{ - Loads Rcpp modules on package startup -} -\description{ - \emph{Note:} As of release 0.12.5, this function is deprecated; - \code{\link{loadModule}} should be used instead. - - Function to simplify loading Rcpp modules contained in a package. - This function must be called from the \code{.onLoad} function of a package. - It uses the \code{RcppModules} field of the package \code{DESCRIPTION} file - to query the names of the modules that the package should export, loads each module, - and \code{\link{populate}} each module into the package NAMESPACE. -} -\usage{ - loadRcppModules(direct=TRUE) -} -\arguments{ - \item{direct}{if \code{TRUE} the content of the module is exposed in the - namespace. Otherwise, the module is exposed. } -} -\seealso{ - \code{\link{populate}}, \code{\link{loadModule}} -} -\keyword{interface} diff --git a/vignettes/rmd/Rcpp-modules.Rmd b/vignettes/rmd/Rcpp-modules.Rmd index c54d21948..b8e45678d 100644 --- a/vignettes/rmd/Rcpp-modules.Rmd +++ b/vignettes/rmd/Rcpp-modules.Rmd @@ -1236,36 +1236,6 @@ The `loadModule` function has an argument `what` to control which objects are exposed in the package namespace. The special value `TRUE` means that all objects are exposed. -### Deprecated legacy method using loadRcppModules - -Prior to release 0.9.11, where `loadModule` was introduced, -loading all functions and classes from a module -into a package namespace was achieved using the `loadRcppModules` function -within the `.onLoad` body. - -```{r, eval=FALSE} -.onLoad <- function(libname, pkgname) { - loadRcppModules() -} -``` - -This will look in the package's `DESCRIPTION` file for the `RcppModules` -field, load each declared module and populate their contents into the -package's namespace. For example, a package defining modules -`yada`, `stdVector`, `NumEx` would have this declaration: - -``` -RcppModules: yada, stdVector, NumEx -``` - -The `loadRcppModules` function has a single argument `direct` -with a default value of `TRUE`. With this default value, all content -from the module is exposed directly in the package namespace. If set to -`FALSE`, all content is exposed as components of the module. - -Note: This approach is **deprecated** as of Rcpp 0.12.5, and now triggers a -warning message. Eventually this function will be withdrawn. - ### Just expose the module Alternatively to exposing a module's content via `loadModule`,