Skip to content

Commit

Permalink
revert 0c90228 (#2036) because #2052 is not specific to R 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Sep 29, 2021
1 parent 46fdaf8 commit ab6c922
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## BUG FIXES

- Fixed a regression in **knitr** 1.31 that caused package vignettes to generate (tangle) invalid R scripts with R <= v3.4.4 (thanks, @t-kalinowski, #2052).
- Fixed a regression in **knitr** 1.31 that caused package vignettes to generate (tangle) invalid R scripts (thanks, @t-kalinowski @halldc, #2052).

# CHANGES IN knitr VERSION 1.35

Expand Down
6 changes: 4 additions & 2 deletions R/utils-vignettes.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ vweave = function(file, driver, syntax, encoding = 'UTF-8', quiet = FALSE, ...)
}

vtangle = function(file, ..., encoding = 'UTF-8', quiet = FALSE) {
# a hack for R <= 3.4.4: https://github.com/yihui/knitr/issues/2052
if (Sys.getenv('_R_CHECK_LICENSE_') != '' && getRversion() <= '3.4.4') {
# a hack to generate an empty R script to cheat R CMD check because purl() is
# not reliable (#2052, #2036)
# TODO: use is_R_CMD_check() after xfun >= 0.27 is on CRAN
if (Sys.getenv('_R_CHECK_LICENSE_') != '' && !file.exists(with_ext(file, 'Rout.save'))) {
file = with_ext(file, '.R')
file.create(file)
return(file)
Expand Down

0 comments on commit ab6c922

Please sign in to comment.