Skip to content

Commit

Permalink
use pak insead of confirm_deps for dependency installation
Browse files Browse the repository at this point in the history
  • Loading branch information
infotroph committed Sep 23, 2024
1 parent 5f7bdfe commit 4bfe6fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion docker/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
3 changes: 2 additions & 1 deletion scripts/confirm_deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#'
Expand Down

0 comments on commit 4bfe6fe

Please sign in to comment.