Skip to content

Commit

Permalink
Allow customizing venv starter with env var
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kalinowski committed Jul 11, 2023
1 parent d911e4c commit fc07da7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions R/virtualenv.R
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,14 @@ virtualenv_starter <- function(version = NULL, all = FALSE) {
starters <<- df
}

if(is.character(getOption("reticulate.virtualenv.starter"))) {

for (custom_loc in list(Sys.getenv("RETICULATE_VIRTUALENV_STARTER"),
getOption("reticulate.virtualenv.starter", ""))) {
# Accept user customization, a character vector (or ":" separated string) of
# file paths to python binaries. Paths can be globs, as they are passed on
# to Sys.glob()
lapply(unlist(strsplit(getOption("reticulate.virtualenv.starter"), "[:;]")),
find_starters)
if (custom_loc != "")
lapply(unlist(strsplit(custom_loc, "[:;]")), find_starters)
}

# Find pythons installed via `install_python()` or by directly using pyenv.
Expand Down Expand Up @@ -654,6 +656,3 @@ stop_no_virtualenv_starter <- function(version = NULL) {
stop(paste0(.msg, collapse = "\n"))

}



0 comments on commit fc07da7

Please sign in to comment.