Skip to content

Commit

Permalink
Change .unpackaged_source_repository_apply() and .package_apply() to use
Browse files Browse the repository at this point in the history
regexp patterns instead of wildcard patterns.

git-svn-id: https://svn.r-project.org/R/trunk@87646 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
hornik committed Jan 27, 2025
1 parent af9f81c commit 2205457
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/library/tools/R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ function()
### ** .package_apply

.package_apply <-
function(packages = NULL, FUN, ..., pattern = "*", verbose = TRUE,
function(packages = NULL, FUN, ..., pattern = NULL, verbose = TRUE,
Ncpus = getOption("Ncpus", 1L))
{
## Apply FUN and extra '...' args to all given packages.
Expand All @@ -2079,10 +2079,8 @@ function(packages = NULL, FUN, ..., pattern = "*", verbose = TRUE,
packages <-
unique(utils::installed.packages(priority = "high")[ , 1L])

## For consistency with .unpacked_source_repository_apply(), take
## 'pattern' as a wildcard pattern.
if(pattern != "*")
packages <- packages[grepl(utils::glob2rx(pattern), packages)]
if(!is.null(pattern))
packages <- grepv(pattern, packages)

## Keep in sync with .unpacked_source_repository_apply().
## <FIXME>
Expand Down Expand Up @@ -2629,12 +2627,14 @@ function(expr)
### ** .unpacked_source_repository_apply

.unpacked_source_repository_apply <-
function(dir, FUN, ..., pattern = "*", verbose = FALSE,
function(dir, FUN, ..., pattern = NULL, verbose = FALSE,
Ncpus = getOption("Ncpus", 1L))
{
dir <- file_path_as_absolute(dir)

dfiles <- Sys.glob(file.path(dir, pattern, "DESCRIPTION"))
dfiles <- Sys.glob(file.path(dir, "*", "DESCRIPTION"))
if(!is.null(pattern))
dfiles <- dfiles[grepl(pattern, basename(dirname(dfiles)))]
paths <- dirname(dfiles)

## Keep in sync with .package_apply().
Expand Down

0 comments on commit 2205457

Please sign in to comment.