Re: [R] Testing for R CMD INSTALL

2021-07-24 Thread Duncan Murdoch

On 24/07/2021 11:22 a.m., Andrew Simmons wrote:

Hello,


I was wondering if anyone has a way to test if a package is currently being
installed. My solution was to check if environment variable "R_INSTALL_PKG"
was unset, something like:

"R CMD INSTALL-ing" <- function ()
!is.na(Sys.getenv("R_INSTALL_PKG", NA))

Unfortunately, I couldn't find what I was looking for with ?"environment
variables". So if anyone has any better methods, I'd be happy to hear them,
thank you!


Normally if you want to execute special code during installation, you'd 
add a Makevars or Makefile to your package and do it there, but 
R_INSTALL_PKG should be defined during a source install.


I believe that no code from the package is executed during a binary 
install:  it just copies files into the appropriate places.


Duncan

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Testing for R CMD INSTALL

2021-07-24 Thread Bert Gunter
Does ?installed.packages help?

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sat, Jul 24, 2021 at 8:30 AM Andrew Simmons  wrote:

> Hello,
>
>
> I was wondering if anyone has a way to test if a package is currently being
> installed. My solution was to check if environment variable "R_INSTALL_PKG"
> was unset, something like:
>
> "R CMD INSTALL-ing" <- function ()
> !is.na(Sys.getenv("R_INSTALL_PKG", NA))
>
> Unfortunately, I couldn't find what I was looking for with ?"environment
> variables". So if anyone has any better methods, I'd be happy to hear them,
> thank you!
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Testing for R CMD INSTALL

2021-07-24 Thread Andrew Simmons
Hello,


I was wondering if anyone has a way to test if a package is currently being
installed. My solution was to check if environment variable "R_INSTALL_PKG"
was unset, something like:

"R CMD INSTALL-ing" <- function ()
!is.na(Sys.getenv("R_INSTALL_PKG", NA))

Unfortunately, I couldn't find what I was looking for with ?"environment
variables". So if anyone has any better methods, I'd be happy to hear them,
thank you!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.