r-lib / pkgdown

Generate static html documentation for an R package

Home Page:https://pkgdown.r-lib.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

incorrect parsing of library

dkarletsos opened this issue · comments

Hi,

There seems to be an issue with how the parsing of the package is being done.

I know it used to work in version 1.5.1 .

Rscript -e "pkg <- '.'; pkgdown::init_site(pkg); pkgdown::build_home(pkg); pkgdown::build_reference(pkg, examples=FALSE); pkgdown::build_news(pkg); withr::with_temp_libpaths(action = 'prefix', { devtools::install(pkg, upgrade = 'never', reload = FALSE, quiet = FALSE); pkgdown::build_articles(pkg); })"
Using environment default (R version: 4.1.3, platform: aarch64-apple-darwin20)
Warning: Failed to parse usage:

S3method(`$`, ``safeenv::safeenv``)(obj, name)

Warning: Failed to parse usage:

S3method(`$`, ``safeenv::safeenv``)(obj, name) <- value

Warning: Failed to parse usage:

S3method(`[[`, ``safeenv::safeenv``)(obj, name)

Warning: Failed to parse usage:

S3method(`[[`, ``safeenv::safeenv``)(obj, name) <- value

Is your package public?

Any reason why you don't use pkgdown::build_site() directly instead of calling the various steps?

The package is not public.

Pasting the whole error message for better understanding:

Rscript -e "pkg <- '.'; pkgdown::init_site(pkg); pkgdown::build_home(pkg); pkgdown::build_reference(pkg, examples=FALSE); pkgdown::build_news(pkg); withr::with_temp_libpaths(action = 'prefix', { devtools::install(pkg, upgrade = 'never', reload = FALSE, quiet = FALSE); pkgdown::build_articles(pkg); })"
Using environment default (R version: 4.1.3, platform: aarch64-apple-darwin20)
Warning: Failed to parse usage:

S3method(`$`, ``safeenv::safeenv``)(obj, name)

Warning: Failed to parse usage:

S3method(`$`, ``safeenv::safeenv``)(obj, name) <- value

Warning: Failed to parse usage:

S3method(`[[`, ``safeenv::safeenv``)(obj, name)

Warning: Failed to parse usage:

S3method(`[[`, ``safeenv::safeenv``)(obj, name) <- value

-- Building function reference -------------------------------------------------

Error in `map2()`:

ℹ In index: 1.

Caused by error in `purrr::map2()`:

ℹ In index: 1.

Caused by error in `.f()`:

! The package "`$.safeenv" is required as it's used in the reference index.

Also, please have a look at this.

#' Dollar extraction

#'

#' @export

`$.safeenv::safeenv` <- function(obj, name) {

  if (!name %in% names(obj)) {

    stop(

      exceptions::LookupError(

        paste0("Name '", name, "' not found in environment")

      )

    )

  }

  return(.subset2(obj, name))

}

Your code is looking for library $.safeenv, but this is not the correct parsing. The class is called safeenv::safeenv, and the method is $

The namespace contains S3method("$","safeenv::safeenv")

Ah! Then it is likely a duplicate of #2186

Duplicate of #2186

I just tried the sample file with current releases of packages, and got the warnings but no error. Have you tried update.packages()?