Skip to content

Commit

Permalink
version 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi authored and cran-robot committed Sep 8, 2022
1 parent 30fe6ea commit 6b8ce6d
Show file tree
Hide file tree
Showing 41 changed files with 171 additions and 310 deletions.
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: desc
Title: Manipulate DESCRIPTION Files
Version: 1.4.1
Version: 1.4.2
Authors@R: c(
person("Gábor", "Csárdi", , "csardi.gabor@gmail.com", role = c("aut", "cre")),
person("Kirill", "Müller", role = "aut"),
Expand All @@ -14,7 +14,8 @@ Description: Tools to read, write, create, and manipulate DESCRIPTION
files. It is intended for packages that create or manipulate other
packages.
License: MIT + file LICENSE
URL: https://github.com/r-lib/desc#readme, http://r-lib.github.io/desc/
URL: https://github.com/r-lib/desc#readme,
https://r-lib.github.io/desc/
BugReports: https://github.com/r-lib/desc/issues
Depends: R (>= 3.4)
Imports: cli, R6, rprojroot, utils
Expand All @@ -23,18 +24,18 @@ Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1.9000
Collate: 'assertions.R' 'authors-at-r.R' 'built.R' 'classes.R'
'collate.R' 'constants.R' 'deps.R' 'desc-package.R'
'description.R' 'encoding.R' 'latex.R' 'non-oo-api.R'
'package-archives.R' 'read.R' 'remotes.R' 'str.R'
'syntax_checks.R' 'urls.R' 'utils.R' 'validate.R' 'version.R'
NeedsCompilation: no
Packaged: 2022-03-06 12:49:04 UTC; gaborcsardi
Packaged: 2022-09-08 09:02:11 UTC; gaborcsardi
Author: Gábor Csárdi [aut, cre],
Kirill Müller [aut],
Jim Hester [aut],
Maëlle Salmon [ctb] (<https://orcid.org/0000-0002-2815-0399>),
RStudio [cph, fnd]
Repository: CRAN
Date/Publication: 2022-03-06 13:20:02 UTC
Date/Publication: 2022-09-08 10:52:55 UTC
79 changes: 39 additions & 40 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
9f1eaf15a03d26e9a55339031bfd508c *DESCRIPTION
c856ceea22b42b35268a8bd51e99da4f *DESCRIPTION
025c0d2002ef2eee68d6efeb1b491b51 *LICENSE
cda5bf9eefa1157da162e50ecb38919c *NAMESPACE
188b51aa2e749eca20c84c9f28dfedd1 *NEWS.md
570f17af2ba3e0a2fda3c06038a9c3f4 *NEWS.md
d6edec2435feaa0792477bbfe4e032cd *R/assertions.R
1fdc4221a032f5ea0ffb328ec459e442 *R/authors-at-r.R
bba09b2d368a760ad19678aea7cd01da *R/built.R
Expand All @@ -10,56 +10,55 @@ bf387d51df1ba668d11d96b84ac9df20 *R/collate.R
ee9a900a7a9549ae5c6ddbffe91cd863 *R/constants.R
68a4318544769e6ee2c5bf01383f5212 *R/deps.R
e472920fcb3a841bcf6e59f6fa57744e *R/desc-package.R
4c579bc9758670408dbda520eda9e475 *R/description.R
e4e2a5cfc8f9f6650661c0eff718b8a6 *R/description.R
179812a079517af3f4d45539f78f81da *R/encoding.R
8b53a4c108f2cba9e3b2684b30b00df0 *R/latex.R
971ad8bd7d7c7fd574cab72924ba38f9 *R/non-oo-api.R
9bacbdb897e27c2c71391c36bdf46e46 *R/non-oo-api.R
bb45ae84f88b75c2bdaa05189109dbed *R/package-archives.R
f4781d32b4ca2cad5105a5f93b443a0c *R/read.R
52bc0adb410feb2b9b6060beb716efdc *R/remotes.R
16aca8c06bc81124efc1d3f0229f972f *R/str.R
348982602877181dbe17f9d5bd2c5261 *R/syntax_checks.R
405478f8b2cfc01cf2f787f9ffd7b449 *R/urls.R
d79d386ccd998f5b7675ba5f871e3561 *R/utils.R
fff3ad3bdde0ddb83c2221bce041ed45 *R/utils.R
7609c65315c4ccc461b4312b88e44e62 *R/validate.R
affa974abb2a0c36868cde801390d7c9 *R/version.R
147b70677f7e80296251b361ccddf7d2 *README.md
4505ddb26745ba6b7eac34786aeb14d5 *inst/README.Rmd
8811749c95dc5143a79ae350e79cc61d *README.md
e312e0eb3e0c008b552e7f53f9e16ccc *inst/WORDLIST
01fb02223acdafc3781bf5ebfbbf2add *man/check_encoding.Rd
c2d77f93427331878c2374a639e88dbc *man/check_field.Rd
989c2705160460316e2a81fa5e013b66 *man/cran_ascii_fields.Rd
cbaed6899fca937299c001a2fd1f3c01 *man/cran_valid_fields.Rd
b0c4d19c717f7bc0b9bbcea05d21f6f0 *man/dep_types.Rd
cc6f3a117225097388d90c6529b2e48c *man/desc-package.Rd
db0ca10b87f15deaa050db793b5a9e74 *man/desc-package.Rd
24014a8207759b30cfc66becacb29762 *man/desc.Rd
92055f0c1ce594f192f518b4b5877875 *man/desc_add_author.Rd
77309070c0a3ca2514f178f644028e21 *man/desc_add_author_gh.Rd
55ebda020a404f17e847017dd55fb1cf *man/desc_add_me.Rd
7cf8a4bc78e998de100e8dab1e6c8a23 *man/desc_add_orcid.Rd
5b929f4154caf1f82bc35a93c4b5adf8 *man/desc_add_remotes.Rd
44bcf8111089938cee0140119842f61a *man/desc_add_role.Rd
2c03c780a6c7b88f55967193a170e8a6 *man/desc_add_to_collate.Rd
d6e43c3a3af0267c5436e02eb33c0a35 *man/desc_add_urls.Rd
2f6175ebc0ceee95250f01bd7cb7da23 *man/desc_bump_version.Rd
a9c73208822fad0fdf215089ddb1aa96 *man/desc_change_maintainer.Rd
b24b4388898007742c5025a7d2ae179e *man/desc_clear_remotes.Rd
60093cc8e43f1976e13b84ef7fb4186d *man/desc_clear_urls.Rd
abfc7d89f89d6bd5d0f9038da7ed6370 *man/desc_coerce_authors_at_r.Rd
7f27b7b575196d66950f81ca5930cf3a *man/desc_del.Rd
72b06b749e903b0eaff5ae9ffd36fb49 *man/desc_del_author.Rd
ce2ca109572f252367a4817d55d0eeb8 *man/desc_del_collate.Rd
bd8ff92a833edd86707c3c7c99ddfb47 *man/desc_del_dep.Rd
b842527374899978b50de2ed28313f20 *man/desc_del_deps.Rd
1e800d4fdea7f1f946ed8064ddfd5062 *man/desc_del_from_collate.Rd
03d1e219fb4949cb5b5be9a81d500d44 *man/desc_del_remotes.Rd
f1e967d1bf05f5ff517b38b26dcb7ca5 *man/desc_del_role.Rd
5e9611d442f386a188c659b51ee59400 *man/desc_del_urls.Rd
b417f121a20dfbbccf56f9eb1accda8c *man/desc_add_author.Rd
2089882336d474358f53375458798deb *man/desc_add_author_gh.Rd
6bd1a216c1fc06f8d7510dbb61381dea *man/desc_add_me.Rd
e00c32c8d6f957c78992f980960b5c9e *man/desc_add_orcid.Rd
33cdf44dfa84917a667d39ba71a11969 *man/desc_add_remotes.Rd
765a176a03b8be3ffd3265c33a6497c4 *man/desc_add_role.Rd
9b7dc1f24a62ff27048ee93133cb8edc *man/desc_add_to_collate.Rd
438b6c27d02003861633e391e8d1cc0b *man/desc_add_urls.Rd
8b9263dea7dee2ded3a378f2a46d06fd *man/desc_bump_version.Rd
22f84f8b80559d6c179e629f576025ff *man/desc_change_maintainer.Rd
1a11d3c6bc7d4c9615dce1641f09d706 *man/desc_clear_remotes.Rd
0a9b046205d55037237e61afac45e618 *man/desc_clear_urls.Rd
0ad047c69a42035aedb51889bf136ae0 *man/desc_coerce_authors_at_r.Rd
091763777ce221c3e98b25e4b7460d5b *man/desc_del.Rd
10329f0d73bc071b9c05b1b311c8078b *man/desc_del_author.Rd
f5ebef4fb3706c18c50d9ec4c9320462 *man/desc_del_collate.Rd
ef397c201adc8d7863b874286950c547 *man/desc_del_dep.Rd
23aaa0bcb9172a7aa9cedb5edc8cb121 *man/desc_del_deps.Rd
cebab5f00c85002cbe980cbfa6197564 *man/desc_del_from_collate.Rd
f187a3102c9776dc2574d45f576dfdb1 *man/desc_del_remotes.Rd
cc7446e070e19af2f50d22e968782e9d *man/desc_del_role.Rd
83ccfd96276254ac999aa204134c606f *man/desc_del_urls.Rd
5c1396ac9d3586a32ac8cbebbfda4b51 *man/desc_fields.Rd
64653c5795c25b9491129c9e6e2fcf23 *man/desc_get.Rd
14dd969fff204656d83d214d2ba4c922 *man/desc_get_author.Rd
3167f9b829a883585470e28c0e936d50 *man/desc_get_authors.Rd
3df3250740f5f7995276b037529e449e *man/desc_get_built.Rd
2faca6ed6bbe0f70f5336d3f055b9fee *man/desc_get_built.Rd
47e70dae75e334fdf69ef884f0a951f0 *man/desc_get_collate.Rd
680852457906c05d84e68043997f3fea *man/desc_get_deps.Rd
2080487a8de1f9fb2473fd1756f24a7e *man/desc_get_field.Rd
Expand All @@ -73,17 +72,17 @@ de270aca72c511069437dab61f2c6620 *man/desc_has_fields.Rd
6c1f784506911f67d26aa7357e9cac33 *man/desc_print.Rd
c7cfb95e2db62941781e102a487e3dc4 *man/desc_reformat_fields.Rd
6a80f486eb35186dab18dc7abcc5c387 *man/desc_reorder_fields.Rd
91fd71d462e04da54ab8ad8c14dbe54c *man/desc_set.Rd
49734815ae7f3d9880b69bf48267c359 *man/desc_set_authors.Rd
6014b00d5d75419c2844725b0489a7c7 *man/desc_set_collate.Rd
038aebdebef6d532b25ff117748aa83a *man/desc_set_dep.Rd
e4ccb59c4ddad37a6d59d31320f9bdc5 *man/desc_set_deps.Rd
533fea90e62438ad9aa3bfd237c61cb5 *man/desc_set_remotes.Rd
9f51cab2c798fc63c4fdc7624aca6ae0 *man/desc_set_urls.Rd
d2f464310b0c6881c93b4f9b35f50272 *man/desc_set_version.Rd
824a93308fc0656db18acb99d05f6284 *man/desc_set.Rd
0d0562ff0c050ef0ebaefa83ddf9bddd *man/desc_set_authors.Rd
52fd602e9ea28d42abc1410bb15ca6a3 *man/desc_set_collate.Rd
33523a469bf8a3dd10b7f969153e2ddb *man/desc_set_dep.Rd
7534732a6c46c00939f7f85f089fd73f *man/desc_set_deps.Rd
eadec17f4cf2b97c41266520d882ae5b *man/desc_set_remotes.Rd
5e0cef547c619a28e48eff0db089348d *man/desc_set_urls.Rd
7748e452d2eea88420d180773d75adb2 *man/desc_set_version.Rd
644b0b378ca68574140981e51075c4b9 *man/desc_to_latex.Rd
3796d76d4f7e600ff05a25dff40e9f9a *man/desc_validate.Rd
7af30a476e4252738f9ac0ac0dc3e363 *man/description.Rd
651ded1e2816c31f49af9542ade491af *man/description.Rd
0c3230ab7963e245ba6603437a0e5f09 *tests/testthat.R
be96b5143b1d6266291d4f09583b9cee *tests/testthat/D1
3ed110bbcb9f78245c4eb19d9e4c07ce *tests/testthat/D10
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# desc 1.4.2

* The `description$write()` method, and thus all `desc_*()` functions work
correctly now on R 4.3.x for packages that declare a non-UTF-8 encoding.

# desc 1.4.1

Expand Down
24 changes: 15 additions & 9 deletions R/description.R
Original file line number Diff line number Diff line change
Expand Up @@ -809,17 +809,17 @@ idesc_write <- function(self, private, file) {
}

mat <- idesc_as_matrix(private$data)
if ("Encoding" %in% colnames(mat)) {
encoding <- mat[, "Encoding"]
mat[] <- iconv(mat[], from = "UTF-8", to = encoding)
}
# This is to avoid re-encoding
Encoding(mat) <- "unknown"

## Need to write to a temp file first, to preserve absense of trailing ws
## Need to write to a temp file first, to preserve absense of trailing ws,
## and also because recently write.dcf cannot write out files in unknown
## encodings. So we write the file in UTF-8 and then re-encode it later.
tmp <- tempfile()
on.exit(unlink(tmp), add = TRUE)
write.dcf(mat, file = tmp, keep.white = names(private$data))
## Need to tell older R not to mess with the encoding
## Cannot do this for newer R, but for newer R we use useBytes = TRUE
## in write_dcf()
if (getRversion() < "4.2.0") Encoding(mat) <- "unknown"
write_dcf(mat, file = tmp, keep.white = names(private$data))

removed <- ! names(private$notws) %in% colnames(mat)
if (any(removed)) private$notws <- private$notws[! removed]
Expand All @@ -829,7 +829,13 @@ idesc_write <- function(self, private, file) {

ofile <- file(file, raw = TRUE, open = "wb+")
on.exit(close(ofile), add = TRUE)
writeLines(readLines(tmp), ofile)

lines <- readLines(tmp)
if ("Encoding" %in% colnames(mat)) {
encoding <- mat[, "Encoding"]
lines <- iconv(lines, from = "UTF-8", to = encoding)
}
writeLines(lines, ofile, useBytes = TRUE)

invisible(self)
}
Expand Down
2 changes: 1 addition & 1 deletion R/non-oo-api.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ desc_get_list <- generate_api("get_list", self = FALSE)
#' @param file DESCRIPTION file to use. By default the DESCRIPTION
#' file of the current package (i.e. the package the working directory
#' is part of) is used.
#' @param normalize Whether to normalize the write when writing back
#' @param normalize Whether to "normalize" (reorder and reformat) the fields when writing back
#' the result. See [desc_normalize()].
#' @param key Key to set in `desc_set_list()`.
#' @param list_value Character vector, to collapse in
Expand Down
10 changes: 9 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
`%||%` <- function(l, r) if (is.null(l)) r else l

str_trim <- function(x) {
sub("^\\s+", "", sub("\\s+$", "", x))
sub("^\\s+", "", sub("\\s+$", "", x, useBytes = TRUE), useBytes = TRUE)
}

str_squish <- function(x) {
Expand Down Expand Up @@ -191,3 +191,11 @@ desc_message <- function(...) {
message(msg)

}

write_dcf <- function(...) {
if (getRversion() >= "3.5.0") {
write.dcf(..., useBytes = TRUE)
} else {
write.dcf(...)
}
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ desc$get_authors()
#> [3] "Manuel Eugster [aut, cph]"
#> [4] "RStudio [cph]"
#> [5] "Bugs Bunny <bb@acme.com>"
#> [6] "Gabor Csardi <csardi.gabor@gmail.com> [ctb]"
#> [6] "First Last <first.last@dom.com> [ctb]"
#> [7] "Jeroen Ooms <jeroen@berkeley.edu> [ctb]"

If the `Author` field is specified, it can be changed to a `Authors@R`
Expand Down Expand Up @@ -279,19 +279,19 @@ desc_set_dep("newpackage", "Suggests")

#> Package: desc
#> Title: Manipulate DESCRIPTION Files
#> Version: 1.4.0.9000
#> Version: 1.4.1.9000
#> Authors@R (parsed):
#> * Gábor Csárdi <csardi.gabor@gmail.com> [aut, cre]
#> * Kirill Müller [aut]
#> * Jim Hester <james.f.hester@gmail.com> [aut]
#> * Maëlle Salmon [ctb] (<https://orcid.org/0000-0002-2815-0399>)
#> * RStudio fnd [cph]
#> * RStudio [cph, fnd]
#> Maintainer: Gábor Csárdi <csardi.gabor@gmail.com>
#> Description: Tools to read, write, create, and manipulate DESCRIPTION
#> files. It is intended for packages that create or manipulate other
#> packages.
#> License: MIT + file LICENSE
#> URL: https://github.com/r-lib/desc#readme, http://r-lib.github.io/desc/
#> URL: https://github.com/r-lib/desc#readme, https://r-lib.github.io/desc/
#> BugReports: https://github.com/r-lib/desc/issues
#> Depends:
#> R (>= 3.4)
Expand All @@ -314,7 +314,7 @@ desc_set_dep("newpackage", "Suggests")
#> Encoding: UTF-8
#> Language: en-US
#> Roxygen: list(r6 = FALSE, load = "installed", markdown = TRUE)
#> RoxygenNote: 7.1.2
#> RoxygenNote: 7.2.1.9000
#> Collate:
#> 'assertions.R'
#> 'authors-at-r.R'
Expand Down Expand Up @@ -371,7 +371,7 @@ desc_get_deps()
## Code of Conduct

Please note that the desc project is released with a [Contributor Code
of Conduct](http://r-lib.github.io/desc/dev/CODE_OF_CONDUCT.html). By
of Conduct](https://r-lib.github.io/desc/dev/CODE_OF_CONDUCT.html). By
contributing to this project, you agree to abide by its terms.

## License
Expand Down
Loading

0 comments on commit 6b8ce6d

Please sign in to comment.