无论Rd文件是否包含R CMD build,\PR{}的行为都不同。有关宏的详细信息,请参见写R扩展。
示例当Rd文件不包含\PR{}时
$ R CMD build test
* checking for file 'test/DESCRIPTION' ... OK
* preparing 'test':
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'test_0.1.tar.gz'当Rd文件包含\PR{}时的示例
$ R CMD build test
* checking for file 'test/DESCRIPTION' ... OK
* preparing 'test':
* checking DESCRIPTION meta-information ... OK
* installing the package to process help pages
* saving partial Rd database
* building the PDF package manual # <- this
Hmm ... looks like a package # <- this
Converting Rd files to LaTeX # <- this
Creating pdf output from LaTeX ... # <- this
Saving output to 'xxx/test.pdf' ... # <- this
Done # <- this
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'test_0.1.tar.gz'附加阶段(即building the PDF package manual,在旧计算机上可能相当慢)是因为调用了..Rd2pdf in 包裹(第619-625行)。然而,我不明白是什么触发了这一阶段。此外,它只对\PR{}触发,而不对其他宏(如\CRANpkg{}和\doi{} )触发。
有人能追踪到发生了什么以及原因吗?问题仅限于R基函数。我不使用像devtools这样的助手。
最小测试包
封装结构
test
test/man
test/man/one.Rd
test/R
test/R/one.R
test/DESCRIPTION
test/NAMESPACEtest/man/one.Rd
\name{one}
\alias{one}
\title{Get One}
\description{
Rd file containing or not the PR macro:
\PR{1} % comment/uncomment this line as needed
but containing other macros:
\CRANpkg{ggplot2} and \doi{10.1002/wics.147}
}
\usage{
one()
}test/R/one.R
one <- function() 1test/DESCRIPTION
Package: test
Version: 0.1
Title: Test
Author: Nobody
Maintainer: Nobody <no@body.org>
Description: Test.
License: GPL-3test/NAMESPACE
export(one)生成、检查和安装时:
$ R CMD build test
$ R CMD check test_0.1.tar.gz
$ R CMD INSTALL test_0.1.tar.gz发布于 2022-02-17 10:19:33
R核对R's Bugzilla的响应
\PR宏最初只在R自己的NEWS.Rd中使用,在那里stage并不真正适用。 Sexpr的stage=install默认设置可能有历史原因:构建是后来实现的。我同意stage=build通常更适合在非基本包中使用,以避免用PDF手册炸毁tarball。由于\doi宏,通常会包含部分Rd db。 我还没有检查是否/如何修改PR宏而不中断NEWS.Rd处理。注意,WRE中提到的宏只是作为\newcommand的一个例子;我不认为它是通用的。目前还不清楚"PR#“在一个贡献包的帮助下会提到哪个bug跟踪器。最好在这里简单地包含一个bug报告的普通URL。 如果您仍然想使用它,可以在Rd文件的开头设置\RdOpts{stage=build}。(这需要R >= 4.1.0,因为Bug 18073。)
https://stackoverflow.com/questions/71140860
复制相似问题