Skip to content
Prev 1151 / 12125 Next

[R-pkg-devel] Submitting to CRAN a package depending on RGtk2

Hi Duncan and Dirk,

1)  First of all, thanks for your replies
?:
?y?
ou put me in the right direction. Although I have to study a bit to really
get the "syntax", looking into Jeroen github pages I was able to understand
?how the "configure" file is supposed to work. In practice, it is run while
attempting package install and allows detecting if required libraries are
available and suggests to install them otherwise, right ?

 I have to say that this is the only part where Hadley Wickham's excellent
"R packages" web page failed me a bit. Also, the "Configure and cleanup"
section of CRAN's "Writing extensions" manual isn't (overly) helpful for a
newby ;-)
? ?
)
(Note that this is don't meant to criticize - just to report a possible
issue others may also encounter).

I also have a (maybe stupid) question on this: in theory, I could write
this "configuration check" also as a "R" function which sends out "system"
commands if it detects a Linux environment (configuring the commands on the
basis of the detected distro), and call it if/when a function of my package
needing that library is called so that the user is prompted to fix his/her
configuration.
Would that be a "bad practice" ?

2) On a different topic related to my original post. Yesterday, I was
?(?
?hopefully)?
 able to solve the issue regarding
?"?
gWidgetsRGtk
?"?
installation on Windows by using the "pacman" package to avoid calls to
"requireNamespace".

In practice, in my "main" function (MODIStsp.R) *where before I had*:





* # On interactive execution, load Rgtk2  if (gui) {   # "gui" is a flag
specifying if we are running an "interactive" session
requireNamespace("gWidgetsRGtk2")    options("guiToolkit" = "RGtk2")  }*

*now I have:??*




















*if (gui) { # "gui" is a flag specifying if we are running an "interactive"
session     # Use p_exists to check if gWidgetsRGtk2 is installed    if
(!pacman::p_exists("gWidgetsRGtk2", local = TRUE)) {          # If not, ask
user to install it      message("Library 'gWidgetsRgtk2' is not installed.
It is required to run MODIStsp !               Do you want to install it
now ?", type = " y/n")      inst_gw <- readline()      if (inst_gw =="y") {
# If user selects "y", use "p_load" to install the package
pacman::p_load("gWidgetsRGtk2")      } else {       # If user selects "n",
send message and exit.              stop("MODIStsp can not work withouth
gWidgetsRGtk2 ! Exiting !")      }           }    options("guiToolkit" =
"RGtk2")  }*

In this way, I can:

1)
?R?
emove
??
gWidgetsRgtk2 from my dependencies, so that I get no WARNINGS while
checking the package
2)
?A?
void the problems related to GTK+ library installation that where
preventing install_github to complete properly
? if I had ?gWidgetsRgtk2 as a dependency?
.

I checked this both on Windows and Linux, and it works.

Although I know that this is a bit of hack, could this be a "viable"
solution ?


regards,

Lorenzo

On 20 October 2016 at 00:06, Duncan Murdoch <murdoch.duncan at gmail.com>
wrote: