Use more common package definition

This commit is contained in:
Lorenz 2021-05-03 18:08:22 +02:00
parent 7f13fa5d5f
commit a19a59652f

View file

@ -107,11 +107,13 @@ def install_environment(
'renv::activate("', file.path(getwd()), '"); ' 'renv::activate("', file.path(getwd()), '"); '
) )
writeLines(activate_statement, 'activate.R') writeLines(activate_statement, 'activate.R')
is_package <- tryCatch({{ is_package <- tryCatch(
content_desc <- read.dcf(file.path(prefix_dir, 'DESCRIPTION')) {{
suppressWarnings(unname(content_desc[,'Type']) == "Package") path_desc <- file.path(prefix_dir, 'DESCRIPTION')
}}, suppressWarnings(desc <- read.dcf(path_desc))
error = function(...) FALSE "Package" %in% colnames(desc)
}},
error = function(...) FALSE
) )
if (is_package) {{ if (is_package) {{
renv::install(prefix_dir) renv::install(prefix_dir)