From 4bfe6fe7abb84c3aa0ec0ffa53965ff6ba8a4a6d Mon Sep 17 00:00:00 2001 From: Chris Black Date: Wed, 24 Jul 2024 22:49:36 -0700 Subject: [PATCH] use pak insead of confirm_deps for dependency installation --- Makefile | 16 ++++++++++++---- docker/base/Dockerfile | 1 - scripts/confirm_deps.R | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 273592d6e67..ea773f25252 100644 --- a/Makefile +++ b/Makefile @@ -70,8 +70,10 @@ files_in_dir = $(call drop_parents, $(call recurse_dir, $1)) # HACK: NA vs TRUE switch on dependencies argument is an ugly workaround for # a circular dependency between benchmark and data.land. # When this is fixed, can go back to simple `dependencies = TRUE` -depends_R_pkg = ./scripts/time.sh "depends ${1}" ./scripts/confirm_deps.R ${1} \ - $(if $(findstring modules/benchmark,$(1)),NA,TRUE) +depends_R_pkg = ./scripts/time.sh "depends ${1}" Rscript \ + -e "pak::local_install_deps('$(strip $(1))'," \ + -e "dependencies = $(if $(findstring modules/benchmark,$(1)),NA,TRUE)," \ + -e "upgrade = FALSE)" install_R_pkg = ./scripts/time.sh "install ${1}" Rscript \ -e ${SETROPTIONS} \ -e "remotes::install_local('$(strip $(1))', force=TRUE, dependencies=FALSE, upgrade=FALSE)" @@ -146,7 +148,13 @@ clean: find models/basgra/src \( -name \*.mod -o -name \*.o -o -name \*.so \) -delete .install/devtools: | .install - + ./scripts/time.sh "devtools ${1}" Rscript -e ${SETROPTIONS} -e "if(!requireNamespace('devtools', quietly = TRUE)) install.packages('devtools')" + + ./scripts/time.sh "devtools ${1}" Rscript -e ${SETROPTIONS} \ + -e "if(!requireNamespace('devtools', quietly = TRUE)) install.packages('devtools')" + echo `date` > $@ + +.install/pak: | .install + + ./scripts/time.sh "pak ${1}" Rscript -e ${SETROPTIONS} \ + -e "if(!requireNamespace('pak', quietly = TRUE)) install.packages('pak')" echo `date` > $@ .install/roxygen2: | .install .install/devtools @@ -167,7 +175,7 @@ clean: + ./scripts/time.sh "mockery ${1}" Rscript -e ${SETROPTIONS} -e "if(!requireNamespace('mockery', quietly = TRUE)) install.packages('mockery')" echo `date` > $@ -$(ALL_PKGS_I) $(ALL_PKGS_C) $(ALL_PKGS_T) $(ALL_PKGS_D): | .install/devtools .install/roxygen2 .install/testthat +$(ALL_PKGS_I) $(ALL_PKGS_C) $(ALL_PKGS_T) $(ALL_PKGS_D): | .install/devtools .install/pak .install/roxygen2 .install/testthat .SECONDEXPANSION: .doc/%: $$(call files_in_dir, %) | $$(@D) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index abbffd47c9b..03a951b47dd 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -17,7 +17,6 @@ ARG PECAN_GIT_DATE="unknown" # copy folders COPY Makefile Makefile.depends /pecan/ COPY scripts/time.sh /pecan/scripts/time.sh -COPY scripts/confirm_deps.R /pecan/scripts/confirm_deps.R COPY base /pecan/base/ COPY modules /pecan/modules/ COPY models /pecan/models/ diff --git a/scripts/confirm_deps.R b/scripts/confirm_deps.R index fd272c1c29b..829273fc996 100755 --- a/scripts/confirm_deps.R +++ b/scripts/confirm_deps.R @@ -4,7 +4,8 @@ # ./confirm_deps path/to/package [dependencies] # Usage as a function: source in and use as documented below - +# NOTE: Superseded. +# `pak::local_install_deps(..., upgrade = FALSE)` now does this nicely. #' Check whether a local package's dependencies are already satisfied #'