Skip to content

Commit

Permalink
provide options(tinytex.upgrade = TRUE) to automatically upgrade Tiny…
Browse files Browse the repository at this point in the history
…TeX when a new version of TeX Live is released each year
  • Loading branch information
yihui committed Apr 2, 2024
1 parent 5483604 commit ae0458c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tinytex
Type: Package
Title: Helper Functions to Install and Maintain TeX Live, and Compile LaTeX Documents
Version: 0.50.1
Version: 0.50.2
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")),
person(given = "Posit Software, PBC", role = c("cph", "fnd")),
Expand Down
21 changes: 16 additions & 5 deletions R/tlmgr.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,27 @@ tlmgr_update = function(
# check if a new version of TeX Live has been released and give instructions on
# how to upgrade
check_tl_version = function(x) {
if (length(x) == 0) return()
i = grep('Local TeX Live \\([0-9]+) is older than remote repository \\([0-9]+)', x)
if (length(i) == 0) return()
message(
if (length(i) > 0) auto_upgrade()
.global$update_noted = TRUE
}

# provide a way options(tinytex.upgrade = TRUE) to automatically upgrade TinyTeX
# (this is an ugly workaround for rstudio/revdepcheck-cloud/#115)
auto_upgrade = function() {
up = is_tinytex() && getOption(
'tinytex.upgrade',
all(Sys.getenv(c('DEV_PACKAGE_TARBALL', 'OUTPUT_S3_PATH')) != '')
)
if (!up) return(message(
'A new version of TeX Live has been released. If you need to install or update ',
'any LaTeX packages, you have to upgrade ', if (!is_tinytex()) 'TeX Live.' else c(
'TinyTeX with tinytex::reinstall_tinytex(repository = "illinois").'
)
)
.global$update_noted = TRUE
))
root = tinytex_root()
message('Trying to upgrade TinyTeX automatically now...')
reinstall_tinytex(force = TRUE, dir = if (file.access(root, 2) == 0) root else default_inst())
}

delete_tlpdb_files = function() {
Expand Down

0 comments on commit ae0458c

Please sign in to comment.