@@ -176,21 +176,21 @@ jobs:
176176 build_args = "--no-build-vignettes"
177177 check_args = c(check_args, "--no-build-vignettes", "--ignore-vignettes")
178178 }
179- locale = Sys.getenv("R_CMD_CHECK_LC_ALL") # only set on Linux
180- utf8locale = grepl("utf8", locale )
181- if (requireNamespace("rcmdcheck", quietly=TRUE) && utf8locale ) {
182- if (nzchar(locale )) Sys.setenv(LC_ALL = locale )
179+ testing_locale = Sys.getenv("R_CMD_CHECK_LC_ALL") # only set on Linux
180+ non_utf8_locale = nzchar(testing_locale) && ! grepl("utf8", testing_locale )
181+ if (requireNamespace("rcmdcheck", quietly=TRUE) && !non_utf8_locale ) {
182+ if (nzchar(testing_locale )) Sys.setenv(LC_ALL = testing_locale )
183183 rcmdcheck::rcmdcheck(args=check_args, build_args=build_args, error_on="warning", check_dir="check")
184184 } else {
185185 Rbin = if (.Platform$OS.type == "windows") "R.exe" else "R"
186186 system2(Rbin, c("CMD", "build", ".", build_args))
187187 dt_tar = list.files(pattern = "^data[.]table_.*[.]tar[.]gz$")
188188 if (!length(dt_tar)) stop("Built tar.gz not found among: ", toString(list.files()))
189- if (nzchar(locale )) Sys.setenv(LC_ALL = locale )
189+ if (nzchar(testing_locale )) Sys.setenv(LC_ALL = testing_locale )
190190 res = system2(Rbin, c("CMD", "check", dt_tar[1L], check_args), stdout=TRUE, stderr=TRUE)
191191 status = attr(res, "status")
192- if (!utf8locale )
193- res = iconv(res, sub(".*[.]", "", locale ), "UTF-8", "byte")
192+ if (non_utf8_locale )
193+ res = iconv(res, sub(".*[.]", "", testing_locale ), "UTF-8", "byte")
194194 writeLines(res, useBytes = TRUE)
195195 if (!is.null(status) || anyNA(res) || any(grepl("^Status:.*(ERROR|WARNING)", res))) {
196196 stop("R CMD check failed")
0 commit comments