-
Notifications
You must be signed in to change notification settings - Fork 29k
[MINOR][R] small tidying of sh scripts for R #28419
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
Conversation
|
Test build #122116 has finished for PR 28419 at commit
|
|
Test build #122125 has finished for PR 28419 at commit
|
| devtools::install_github("jimhester/[email protected]") | ||
| # Installs lintr if needed | ||
| if (!requireNamespace("lintr")) { | ||
| install.packages('lintr') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there was sort of a reason for installing a particular version: #26564 (comment) But the logic seems to be "use the new 2.0.0 version". This would always pick up the latest. I'm guessing that's OK, @dongjoon-hyun ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment said the CRAN version wasn't recent enough so I assumed >= 2.0.0 would be fine. & we're passing so that's a good sign.
Anyway, yes, would be good to confirm on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya. It looks okay since this seems to install lintr 2.0.1 as of today.
|
|
||
| # Generate Rd files if devtools is installed | ||
| "$R_SCRIPT_PATH/Rscript" -e ' if("devtools" %in% rownames(installed.packages())) { library(devtools); setwd("'$FWDIR'"); devtools::document(pkg="./pkg", roclets=c("rd")) }' | ||
| "$R_SCRIPT_PATH/Rscript" -e ' if(requireNamespace("devtools", quietly=TRUE)) { setwd("'$FWDIR'"); devtools::document(pkg="./pkg", roclets="rd") }' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems fine but I don't know these commands; any potential behavior change here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requireNamespace is a more minimal test to be sure devtools:: will work correctly.
This is the more common route to check for available functionality, e.g. for Suggested (not required) packages. this is how the suggested arrow dependency is handled, for example:
grep -r "requireNamespace" R/pkg/R -n
R/pkg/R/types.R:91: if (!requireNamespace("arrow", quietly = TRUE)) {
R/pkg/R/deserialize.R:235: if (requireNamespace("arrow", quietly = TRUE)) {
R/pkg/R/SQLContext.R:152: if (requireNamespace("arrow", quietly = TRUE)) {
R/pkg/R/serialize.R:225: if (requireNamespace("arrow", quietly = TRUE)) {
R/pkg/R/DataFrame.R:1229: if (requireNamespace("arrow", quietly = TRUE)) {
The installed.packages is much more cumbersome -- it looks up the full set of available packages, then searches to see if this particular one is there.
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM. Merged to master. Thank you, @MichaelChirico and @srowen .
What changes were proposed in this pull request?
Some tidying of
shscripts inR/Why are the changes needed?
Not strictly needed, but the
'devtools' %in% installed.packages()line in particular is "improper" / proabbly slowDoes this PR introduce any user-facing change?
No
How was this patch tested?
Not