@@ -76,13 +76,6 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
7676 if (missing(destDir ))
7777 destDir <- file.path(reposRoot , " manuals" )
7878
79- rCmdRd2pdf <- function (r_path , output , pkg , pkgDir ) {
80- CmdRd2pdf <- paste0(" CMD Rd2pdf --no-preview --output=" , output ,
81- " --title=" , pkg , " " , pkgDir )
82- print(paste(r_path , CmdRd2pdf ))
83- system2(r_path , CmdRd2pdf , stdout = FALSE , stderr = FALSE )
84- }
85-
8679 buildManualsFromTarball <- function (tarball , unpackDir = " ." ) {
8780 # # helper function to unpack pdf & Rd files from the vig
8881 cleanUnpackDir(tarball , unpackDir , " man" , " .*\\ .(pdf|Rd|rd)$" )
@@ -92,20 +85,21 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
9285 pkg <- pkgName(tarball )
9386 pkgDir <- file.path(unpackDir , pkg )
9487 pkgManDir <- file.path(pkgDir , " man" )
95- pdf_file <- paste(file.path(pkgManDir , pkg ), " pdf" , sep = " ." )
88+ if (dir.exists(pkgManDir ))
89+ unlink(pkgManDir , recursive = TRUE )
90+ tmp_file <- paste(file.path(pkgDir , pkg ), " pdf" , sep = " ." )
9691 r_path <- file.path(Sys.getenv(" R_HOME" ), " bin" , " R" )
97- # Fails if pdf exists or man exists with no .Rd files
98- ret <- rCmdRd2pdf( r_path , pdf_file , pkg , pkgDir )
99- if ( ret != 0 || ! file.exists( pdf_file )) {
100- # Make temporary file to move to man path
101- tmp_file <- paste( file.path( pkgDir , pkg ), " pdf " , sep = " . " )
102- unlink( pkgManDir , recursive = TRUE )
103- ret <- rCmdRd2pdf( r_path , tmp_file , pkg , pkgDir )
92+ CmdRd2pdf <- paste0( " CMD Rd2pdf --no-preview --output= " , tmp_file ,
93+ " --title= " , pkg , " " , pkgDir )
94+ print(paste( r_path , CmdRd2pdf ))
95+ system2( r_path , CmdRd2pdf , stdout = FALSE , stderr = FALSE )
96+ if ( ! file.exists( tmp_file ) )
97+ stop( " non-zero exit status " , ret , " building ref man: " , pkg )
98+ if ( ! dir.exists( pkgManDir ) )
10499 dir.create(pkgManDir )
105- file.rename(tmp_file , pdf_file )
106- if (ret != 0 )
107- stop(" non-zero exit status " , ret , " building ref man: " , pkg )
108- }
100+ file.rename(tmp_file ,
101+ paste(file.path(pkgManDir , pkg ), " pdf" , sep = " ." ))
102+ cleanUnpackDir(tarball , unpackDir , " man" , " .*\\ .(Rd|rd)$" )
109103 TRUE
110104 }
111105
@@ -121,7 +115,7 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
121115 tryCatch({
122116 buildManualsFromTarball(tarball , ... )
123117 }, error = function (e ) {
124- warning(" error extracting manual for " , tarball ,
118+ warning(" error extracting manual for: " , tarball ,
125119 " \n " , conditionMessage(e ))
126120 FALSE
127121 })
0 commit comments