r-lib / pkgbuild

Find tools needed to build R packages
https://pkgbuild.r-lib.org
Other
65 stars 33 forks source link

Request: opt out of automated install prompt #137

Closed karldw closed 1 year ago

karldw commented 2 years ago

Hello,

I saw the documentation for has_build_tools, check_build_tools, and with_build_tools says "If run interactively from RStudio, and the build tools are not available these functions will trigger an automated install." I'd like to use pkgbuild for some work that's not directly exposed to the user, so I would like to check has_build_tools without prompting an install process. Is that possible?

For testing on systems with build tools already installed, the following demonstrates the install prompt in RStudio:

pkgbuild:::without_compiler(pkgbuild::has_build_tools())

Thanks!

gaborcsardi commented 1 year ago

Hmmm, you can already do this, actually, by setting an option:

> options(buildtools.check = NULL)
> has_build_tools()
[1] TRUE
> pkgbuild:::without_compiler(pkgbuild::has_build_tools())
[1] FALSE

So I think we don't need to add anything for this, but you can delete that option temporarily, using on.exit() to restore it?