|
4 | 4 | xfun::in_dir('..', xfun::install_dir('tinytex')) |
5 | 5 | if (!tinytex:::tlmgr_available()) stop("tlmgr not available") |
6 | 6 |
|
| 7 | +system2('git', c('checkout', '--', '.')) # drop changes if exist |
| 8 | + |
7 | 9 | owd = setwd('tools') |
8 | 10 |
|
9 | 11 | x0 = tinytex::tl_pkgs() # packages from the minimal installation |
@@ -35,30 +37,24 @@ x1 = sort(unique(c( |
35 | 37 | 'ec', 'inconsolata', 'times', 'tex', 'helvetic', 'dvips', 'metafont', 'mfware', 'xkeyval' |
36 | 38 | ))) |
37 | 39 | tinytex::tlmgr_install(x1) |
38 | | -x2 = sort(readLines('pkgs-custom.txt')) |
39 | | -if (!identical(x1, x2)) stop( |
40 | | - 'pkgs-custom.txt needs to be updated.\n\nPackages required are:\n', |
41 | | - paste(x1, collapse = '\n') |
42 | | -) |
| 40 | +writeLines(x1, 'pkgs-custom.txt') |
43 | 41 |
|
44 | 42 | # any new packages need to be added to pkgs-yihui.txt? |
45 | 43 | tinytex::tlmgr_install(readLines('pkgs-yihui.txt')) |
46 | | -x3 = tinytex::tl_pkgs() |
47 | 44 | build_more = function() { |
48 | 45 | render('test-basic.Rmd', 'beamer_presentation', quiet = TRUE) |
49 | 46 | render('test-kableExtra.Rmd', quiet = TRUE) |
50 | 47 | } |
51 | 48 | build_more() |
52 | 49 | # were there any new packages installed? |
53 | | -x4 = tinytex::tl_pkgs() |
54 | | -if (length(x5 <- setdiff(x4, x3))) stop( |
55 | | - 'pkgs-yihui.txt needs to include:\n', paste(x5, collapse = '\n') |
56 | | -) |
| 50 | +x2 = tinytex::tl_pkgs() |
| 51 | +writeLines(x2, 'pkgs-yihui.txt') |
57 | 52 |
|
58 | 53 | setwd(owd) |
59 | 54 |
|
60 | | -if (!identical(p1 <- tinytex:::tl_platforms(), p2 <- tinytex:::.tl_platforms)) stop( |
61 | | - 'tl_platforms() returned: ', paste(p1, collapse = ', '), |
62 | | - '\n.tl_platforms returned ', paste(p2, collapse = ', '), |
63 | | - '\nThe latter needs to be updated in the tinytex package.' |
64 | | -) |
| 55 | +p = tinytex:::tl_platforms() |
| 56 | +writeLines(c( |
| 57 | + '# a copy of the returned result from tl_platform() is saved here because', |
| 58 | + '# tl_platforms() is a little slow and requires Internet connection', |
| 59 | + strwrap(sprintf('.tl_platforms = c(%s)', paste0("'", p, "'", collapse = ', ')), 80, exdent = 2) |
| 60 | +), 'R/platforms.R') |
0 commit comments