Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run bootstrap.R file on build if present and specified in Config/build #157

Merged
merged 2 commits into from
Jan 30, 2023

Conversation

paleolimbot
Copy link
Contributor

@paleolimbot paleolimbot commented Jan 30, 2023

For r-lib/pkgdepends#303 . Basically, I'm spending a lot of time working in repositories that share sources between Python and R packages and it would be nice if the pak-based tooling worked out-of-the box for things like Remotes: dependencies and check/build/install actions.

The general approach is:

  • Look for bootstrap.R and Config/build/bootstrap: TRUE
  • Use callr::rscript() to run boostrap.R with the working directory set to the source directory

The DESCRIPTION Config option is nice because it makes the opt-in more explicit (in the event that bootstrap.R existed in the package directory already) and because there was already a place to document Config/build options.

As @gaborcsardi pointed out, using Rscript + "boostrap.R" is more portable than a shell script because Rtools might not be installed or on the PATH.

This approach doesn't help with R CMD INSTALL pkg_directory but package authors can always do $R_HOME/bin/Rscript bootstrap.R in configure and/or configure.win, which also would work with devtools::load_all() (I think).

Copy link
Member

@gaborcsardi gaborcsardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@krlmlr
Copy link
Member

krlmlr commented Jun 7, 2023

Should this be included in the dev version of pak already?

@gaborcsardi
Copy link
Member

I am not sure what you mean by "should", but it will be (is?) only included if pak depends on dev pkgbuild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants