Skip to content

Commit

Permalink
only display hash for dev versions
Browse files Browse the repository at this point in the history
  • Loading branch information
infotroph committed Oct 11, 2024
1 parent 5a3faca commit 83af3ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions base/all/R/pecan_version.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ pecan_version <- function(version = max(PEcAn.all::pecan_releases$version),
y = PEcAn.all::pecan_version_history,
all = TRUE)
res <- drop_na_version_rows(res[, cols_to_return])
rownames(res) <- res$package
class(res) <- c("pecan_version_report", class(res))

res
Expand All @@ -119,7 +120,7 @@ drop_na_version_rows <- function(df) {

# Look up git revision, if recorded, from an installed PEcAn package
get_buildhash <- function(pkg) {
# Set if installed from r-universe or via install_github()
# Set if pkg was installed from r-universe or via install_github()
desc_sha <- utils::packageDescription(pkg, fields = "RemoteSha")
if (!is.na(desc_sha)) {
return(substr(desc_sha, 1, 10))
Expand All @@ -139,7 +140,10 @@ print.pecan_version_report <- function(x, ...) {
if (is.null(dots$right)) { dots$right <- FALSE }

xx <- as.data.frame(x)
xx$build_hash[is.na(xx$build_hash)] <- ""
# only print hash for dev versions
# (typically x.y.z.9000, but we'll use anything with a 4th version component)
skip_hash <- is.na(xx$installed[,4]) | is.na(xx$build_hash)
xx$build_hash[skip_hash] <- ""
xx$build_hash <- sub(".{4}\\+mod$", "+mod", xx$build_hash)
xx$installed <- paste0(
xx$installed,
Expand Down

0 comments on commit 83af3ed

Please sign in to comment.