Skip to content

Commit

Permalink
Fix binary building bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Jul 12, 2011
1 parent 6471fff commit c1fbdc0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Expand Up @@ -37,3 +37,4 @@ Collate:
'test.r'
'utils.r'
'vignettes.r'
'os.r'
3 changes: 2 additions & 1 deletion NEWS
Expand Up @@ -17,7 +17,8 @@

* `build` is now exported, and defaults to building in the package's parent
directory. It also gains a new `binary` parameter controls whether a binary
or a source version (with no vignettes or manuals) is built.
or a source version (with no vignettes or manuals) is built. Confusingly,
binary packages are built with `R CMD INSTALL`.

* `install_github` now allows you to specify which branch to download

Expand Down
12 changes: 7 additions & 5 deletions R/build.r
Expand Up @@ -16,13 +16,15 @@ build <- function(pkg = NULL, path = NULL, binary = FALSE) {
}

if (binary) {
options <- "--binary"
cmd <- paste("CMD install ", shQuote(pkg$path), " --build", sep = "")
ext <- if (os() == "win") "zip" else "tgz"
} else {
options <- "--no-manual --no-vignettes"
cmd <- paste("CMD build ", shQuote(pkg$path),
" --no-manual --no-vignettes", sep = "")
ext <- "tar.gz"
}

R(paste("CMD build ", shQuote(pkg$path), " ", options, sep = ""), path)
R(cmd, path)

targz <- paste(pkg$package, "_", pkg$version, ".tar.gz", sep = "")
targz <- paste(pkg$package, "_", pkg$version, ".", ext, sep = "")
file.path(path, targz)
}
10 changes: 10 additions & 0 deletions R/os.r
@@ -0,0 +1,10 @@
os <- function() {
os <- R.Version()$os
if (length(grep("linux", os)) == 1) {
"lin"
} else if (length(grep("darwin", os)) == 1) {
"mac"
} else {
"win"
}
}

0 comments on commit c1fbdc0

Please sign in to comment.