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

with_makevars() does not keep contents of existing ~/.R/Makevars #169

Closed
scanisius opened this issue May 28, 2021 · 1 comment
Closed

with_makevars() does not keep contents of existing ~/.R/Makevars #169

scanisius opened this issue May 28, 2021 · 1 comment

Comments

@scanisius
Copy link

When I use with_makevars() in the presence of an existing ~/.R/Makevars file, the contents of the latter is simply ignored.

> readLines("~/.R/Makevars")
[1] "CC=/usr/local/bin/gcc"

> with_makevars(c(FC="/usr/local/bin/gfortran"), readLines(Sys.getenv("R_MAKEVARS_USER")))
[1] "FC=/usr/local/bin/gfortran"

The source of this issue is the delayed evaluation of the path = makevars_user() default argument. makevars_user() is only evaluated in set_makevars(), where the environment variable R_MAKEVARS_USER has already been changed to point to a temporary filename. If I pass the filename explicitly, the contents of Makevars are correctly retained.

> with_makevars(c(FC="/usr/local/bin/gfortran"), readLines(Sys.getenv("R_MAKEVARS_USER")), path="~/.R/Makevars")
[1] "CC=/usr/local/bin/gcc"      "FC=/usr/local/bin/gfortran"

So this issue can be fixed by forcing the evaluation of the path argument before passing it to set_makevars().

This issue affects local_makevars() too.

@jimhester
Copy link
Member

Thank you for opening the issue and for supplying a reproducible example, it is a big help!

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

No branches or pull requests

2 participants