From 2908f0b05873978f42d5cb9a8fd9eec803648316 Mon Sep 17 00:00:00 2001 From: harelfishbein Date: Mon, 21 Jan 2019 13:06:40 -0800 Subject: [PATCH 1/3] Update repr_help_files_with_topic.r I'm attempting to get repr to build with renjin, hoped that moving the getFromNamespace, and updating the function using the .getHelpFile from the current R source would help. --- R/repr_help_files_with_topic.r | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/R/repr_help_files_with_topic.r b/R/repr_help_files_with_topic.r index ddf6dfc..fb2ae74 100644 --- a/R/repr_help_files_with_topic.r +++ b/R/repr_help_files_with_topic.r @@ -8,21 +8,27 @@ #' @name repr_*.help_files_with_topic NULL -fetch_rd_db <- getFromNamespace('fetchRdDB', 'tools') + # copy of utils:::.getHelpFile, necessary because CRAN doesn’t like us using ::: -get_help_file <- function(file) { +get_help_file <- function(file) +{ path <- dirname(file) dirpath <- dirname(path) - if (!file.exists(dirpath)) - stop(sprintf('invalid %s argument', sQuote('file'))) + if(!file.exists(dirpath)) + stop(gettextf("invalid %s argument", sQuote("file")), domain = NA) pkgname <- basename(dirpath) - rd_db <- file.path(path, pkgname) - if (!file.exists(paste(rd_db, 'rdx', sep = '.'))) - stop(sprintf('package %s exists but was not installed under R >= 2.10.0 so help cannot be accessed', sQuote(pkgname))) - fetch_rd_db(rd_db, basename(file)) + RdDB <- file.path(path, pkgname) + if(!file.exists(paste(RdDB, "rdx", sep = "."))) + stop(gettextf("package %s exists but was not installed under R >= 2.10.0 so help cannot be accessed", sQuote(pkgname)), domain = NA) + # Alternative position for tools may neeed to be specified as in renjin build fails with "ERROR: Object 'fetchRdDB' not found" + pos <- -1 + fetch_rd_db <- getFromNamespace('fetchRdDB', 'tools', pos) + fetch_rd_db(RdDB, basename(file)) } + + #' @importFrom utils capture.output #' @importFrom tools Rd2HTML repr_help_files_with_topic_generic <- function(obj, Rd2_) { From 8b75d2944486520eb8c13da4c529659cb19a5d74 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Tue, 22 Jan 2019 14:56:02 +0000 Subject: [PATCH 2/3] style --- R/repr_help_files_with_topic.r | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/R/repr_help_files_with_topic.r b/R/repr_help_files_with_topic.r index fb2ae74..8f0e529 100644 --- a/R/repr_help_files_with_topic.r +++ b/R/repr_help_files_with_topic.r @@ -9,22 +9,19 @@ NULL - # copy of utils:::.getHelpFile, necessary because CRAN doesn’t like us using ::: -get_help_file <- function(file) -{ +get_help_file <- function(file) { path <- dirname(file) dirpath <- dirname(path) - if(!file.exists(dirpath)) - stop(gettextf("invalid %s argument", sQuote("file")), domain = NA) + if (!file.exists(dirpath)) + stop(gettextf('invalid %s argument', sQuote('file')), domain = NA) pkgname <- basename(dirpath) - RdDB <- file.path(path, pkgname) - if(!file.exists(paste(RdDB, "rdx", sep = "."))) - stop(gettextf("package %s exists but was not installed under R >= 2.10.0 so help cannot be accessed", sQuote(pkgname)), domain = NA) - # Alternative position for tools may neeed to be specified as in renjin build fails with "ERROR: Object 'fetchRdDB' not found" + rd_db <- file.path(path, pkgname) + if(!file.exists(paste(rd_db, 'rdx', sep = '.'))) + stop(gettextf('package %s exists but was not installed under R >= 2.10.0 so help cannot be accessed', sQuote(pkgname)), domain = NA) pos <- -1 fetch_rd_db <- getFromNamespace('fetchRdDB', 'tools', pos) - fetch_rd_db(RdDB, basename(file)) + fetch_rd_db(rd_db, basename(file)) } From c44ef1604917933c39ed77288697f32e9980b9e3 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Tue, 22 Jan 2019 14:56:22 +0000 Subject: [PATCH 3/3] More style --- R/repr_help_files_with_topic.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/repr_help_files_with_topic.r b/R/repr_help_files_with_topic.r index 8f0e529..a5ca7ea 100644 --- a/R/repr_help_files_with_topic.r +++ b/R/repr_help_files_with_topic.r @@ -17,7 +17,7 @@ get_help_file <- function(file) { stop(gettextf('invalid %s argument', sQuote('file')), domain = NA) pkgname <- basename(dirpath) rd_db <- file.path(path, pkgname) - if(!file.exists(paste(rd_db, 'rdx', sep = '.'))) + if (!file.exists(paste(rd_db, 'rdx', sep = '.'))) stop(gettextf('package %s exists but was not installed under R >= 2.10.0 so help cannot be accessed', sQuote(pkgname)), domain = NA) pos <- -1 fetch_rd_db <- getFromNamespace('fetchRdDB', 'tools', pos)