Skip to content

Commit

Permalink
testing use-public-rspm flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sllynn committed Oct 25, 2023
1 parent 4a9e4c5 commit ec256c8
Showing 1 changed file with 29 additions and 28 deletions.
57 changes: 29 additions & 28 deletions R/install_deps.R
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
repos = c(
"https://cran.ma.imperial.ac.uk" = "https://cran.ma.imperial.ac.uk"
,"https://www.stats.bris.ac.uk/R" = "https://www.stats.bris.ac.uk/R"
,"https://cran.rstudio.com/" = "https://cran.rstudio.com/"
)
# repos = c(
# "https://cran.ma.imperial.ac.uk" = "https://cran.ma.imperial.ac.uk"
# ,"https://www.stats.bris.ac.uk/R" = "https://www.stats.bris.ac.uk/R"
# ,"https://cran.rstudio.com/" = "https://cran.rstudio.com/"
# )
options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/focal/latest"))
# CRAN = "https://packagemanager.posit.co/cran/__linux__/focal/latest"
#
# options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))
# options(download.file.extra = sprintf("--header \"User-Agent: R (%s)\"", paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))
#
# print(sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))

options(HTTPUserAgent = sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))
options(download.file.extra = sprintf("--header \"User-Agent: R (%s)\"", paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))

print(sprintf("R/%s R (%s)", getRversion(), paste(getRversion(), R.version["platform"], R.version["arch"], R.version["os"])))

mirror_is_up <- function(x){
out <- tryCatch({
available.packages(contrib.url(x))
}
,error = function(cond){return(0)}
,warning = function(cond){return(0)}
,finally = function(cond){}
)
return(length(out))
}

mirror_status = lapply(repos, mirror_is_up)
for(repo in names(mirror_status)){
if (mirror_status[[repo]] > 1){
repo <<- repo
break
}
}
# mirror_is_up <- function(x){
# out <- tryCatch({
# available.packages(contrib.url(x))
# }
# ,error = function(cond){return(0)}
# ,warning = function(cond){return(0)}
# ,finally = function(cond){}
# )
# return(length(out))
# }
#
# mirror_status = lapply(repos, mirror_is_up)
# for(repo in names(mirror_status)){
# if (mirror_status[[repo]] > 1){
# repo <<- repo
# break
# }
# }

.libPaths(c("/usr/lib/R/site-library", .libPaths()))

Expand Down

0 comments on commit ec256c8

Please sign in to comment.