Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

yet another bugfix for maintainer()

git-svn-id: https://svn.r-project.org/R/trunk@60906 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information...
commit 601e71efc3cf34573b78fc096e0272f641bc455f 1 parent eda9c0e
ripley authored
4 doc/NEWS.Rd
@@ -621,7 +621,9 @@
621 621
622 622 \item The HTML manuals now use directional single quotes.
623 623
624   - \item \code{maintainer()} now converts embedded new lines to spaces.
  624 + \item \code{maintainer()} now converts embedded new lines to
  625 + spaces. It no longer gives a non-obvious error for non-installed
  626 + packages.
625 627
626 628 \item The \code{X11()} device has some protection against
627 629 being used with forked processes \emph{via} package \pkg{parallel}.
7 src/library/utils/R/indices.R
@@ -133,9 +133,12 @@ print.packageDescription <-
133 133
134 134 # Simple convenience functions
135 135
136   -maintainer <- function(pkg) {
  136 +maintainer <- function(pkg)
  137 +{
137 138 force(pkg)
138   - gsub("\n", " ",packageDescription(pkg)$Maintainer, fixed = TRUE)
  139 + desc <- packageDescription(pkg)
  140 + if(is.list(desc)) gsub("\n", " ", desc$Maintainer, fixed = TRUE)
  141 + else NA_character_
139 142 }
140 143
141 144 packageVersion <- function(pkg, lib.loc = NULL)
11 src/library/utils/man/maintainer.Rd
... ... @@ -1,6 +1,6 @@
1 1 % File src/library/utils/man/maintainer.Rd
2 2 % Part of the R package, http://www.R-project.org
3   -% Copyright 1995-2011 R Core Team
  3 +% Copyright 1995-2012 R Core Team
4 4 % Distributed under GPL 2 or later
5 5
6 6 \name{maintainer}
@@ -16,9 +16,7 @@
16 16 maintainer(pkg)
17 17 }
18 18 \arguments{
19   - \item{pkg}{
20   - Character. The name of a single package.
21   -}
  19 + \item{pkg}{Character string. The name of a single package.}
22 20 }
23 21 \details{
24 22 Accesses the package description to return the name and email address of
@@ -32,12 +30,13 @@ maintainer(pkg)
32 30 }
33 31 \value{
34 32 A character string giving the name and email address of the maintainer
35   - of the package.
  33 + of the package, or \code{NA} if no such package is installed.
36 34 }
37 35
38 36 \author{
39 37 David Scott <d.scott@auckland.ac.nz> from code on R-help originally
40   - due to Charlie Sharpsteen <source@sharpsteen.net>.
  38 + due to Charlie Sharpsteen <source@sharpsteen.net>; multiple corrections
  39 + by R-core.
41 40 }
42 41 \references{
43 42 \url{https://stat.ethz.ch/pipermail/r-help/2010-February/230027.html}
6 tests/reg-tests-1b.R
@@ -1993,4 +1993,10 @@ stopifnot(inherits(try(arima.sim(list(order = c(1,0,0), ar = 0.7), n = 0)),
1993 1993 ## one too long in R < 2.15.2
1994 1994
1995 1995
  1996 +## maintainer()
  1997 +maintainer('stats')
  1998 +maintainer("impossible_package_name")
  1999 +## gave an error in R < 2.15.2
  2000 +
  2001 +
1996 2002 proc.time()

0 comments on commit 601e71e

Please sign in to comment.
Something went wrong with that request. Please try again.