@@ -76,13 +76,6 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
76
76
if (missing(destDir ))
77
77
destDir <- file.path(reposRoot , " manuals" )
78
78
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
-
86
79
buildManualsFromTarball <- function (tarball , unpackDir = " ." ) {
87
80
# # helper function to unpack pdf & Rd files from the vig
88
81
cleanUnpackDir(tarball , unpackDir , " man" , " .*\\ .(pdf|Rd|rd)$" )
@@ -92,20 +85,21 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
92
85
pkg <- pkgName(tarball )
93
86
pkgDir <- file.path(unpackDir , pkg )
94
87
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 = " ." )
96
91
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 ) )
104
99
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)$" )
109
103
TRUE
110
104
}
111
105
@@ -121,7 +115,7 @@ extractManuals <- function(reposRoot, srcContrib, destDir) {
121
115
tryCatch({
122
116
buildManualsFromTarball(tarball , ... )
123
117
}, error = function (e ) {
124
- warning(" error extracting manual for " , tarball ,
118
+ warning(" error extracting manual for: " , tarball ,
125
119
" \n " , conditionMessage(e ))
126
120
FALSE
127
121
})
0 commit comments