ropensci-review-tools / pkgstats

Historical statistics of every R package ever
https://docs.ropensci.org/pkgstats/
17 stars 1 forks source link

Error: There is no package called <...> #40

Closed mpadge closed 2 years ago

mpadge commented 2 years ago

From @maelle:

library (pkgstats)
package = list(identifier = "taxa", codeRepository = "https://github.com/ropensci/taxa")
temp_dir <- withr::local_tempdir()
repo <- remotes::parse_github_url(package[["codeRepository"]])
gert::git_clone(
    url = sprintf("https://github.com/%s/%s", repo[["username"]], repo[["repo"]]),
    path = temp_dir
)
stats <- pkgstats::pkgstats(temp_dir)
#> Error:  there is no package called 'taxa'

Created on 2022-04-05 by the reprex package (v2.0.1)

mpadge commented 2 years ago

The :bug: and corresponding error message came from this call https://github.com/ropensci-review-tools/pkgstats/blob/ecb314e34c56d46b23b2b19e75cb914922f02f2d/R/rd-stats.R#L121 to tools::Rd2txt(). Reading through the details there, taxa obviously includes an \Sexpr macro in one man file, which is executed by default at "render" time, which follows "install". Those execution times are in turn defined by a stages parameter, so the solution is to just hard-code that as stages = "build", which is the first possible stage.

mpadge commented 2 years ago

Further info: This happens because of stuff like these lines in taxa, which are in turn taken directly from tidyverse code, and insert Sexpr macros with explicit stages = "render" arguments to insert lifecycle svg badges directly into man files. The solution above simply overrides this values of stages with "build", and so fails to render any (lifecycle or other) svgs in man files, but enables tools::Rd2txt() to work. So it's not a solution as much as just a tricky workaround.

maelle commented 2 years ago

Thanks for the digging & working-around!