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

Lorenzo Busetto lbusett at gmail.com
Thu Oct 20 11:05:52 CEST 2016


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:

> On 19/10/2016 5:24 PM, Lorenzo Busetto wrote:
>
>> Hi Dirk,
>>
>> thanks for the answer. Yes, I know that that does the trick. In fact,
>> in our  github README we have
>> the following intructions:
>>
>> "Install the following required dependencies:
>>
>> Cairo >= 1.0.0, ATK >= 1.10.0, Pango >= 1.10.0, GTK+ >= 2.8.0, GLib >=
>> 2.8.0 (required by package RGtk2)
>> Curl (required by package curl)
>> GDAL >= 1.6.3, PROJ.4 >= 4.4.9 (required by package rgdal)
>>
>
> In your DESCRIPTION file, skip the indirect dependencies.  Your package
> just needs to say it depends on RGtk2, curl, and rgdal (unless it also
> needs to link to those libs).  It is a good idea to give detailed
> instructions in a README file in the package though.
>
>
>> On Debian and Ubuntu-based systems, to install those packages open a
>> terminal and type
>>
>> sudo apt-get install r-cran-cairodevice r-cran-rgtk2
>> libcurl4-openssl-dev libgdal-dev libproj-dev  "
>>
>> One of my questions here (maybe dumb), is how/where I should  specify
>> those dependencies when submitting to CRAN.
>>
>
> As Dirk said, SystemRequirements:, but only for the direct dependencies.
> List the R packages in Depends, Imports, etc.
>
> Is putting intructions like these in the readme of the package
>> sufficient, or do I need to do something else ? That's what I was
>> asking as first point of the "Linux" part of the previous post (sorry
>> if it was not clear).
>>
>
> Try to give instructions for all 3 major platforms (and maybe a few
> variations within each):  Linux, Windows, OS X. If you can, add Solaris:
> once you're accepted onto CRAN, you'll be tested there as well.
>
> Duncan Murdoch
>
>
>> Lorenzo
>>
>> On 19 October 2016 at 22:36, Dirk Eddelbuettel <edd at debian.org> wrote:
>>
>>>
>>> For this subproblem:
>>>
>>> On 19 October 2016 at 22:14, Lorenzo Busetto wrote:
>>> |   On Linux builds, the problem is related but a bit different.
>>> |
>>> |  1. First of all, package "RGTk2" requires some external libraries to
>>>
>>> yu can just install r-cran-rgtk2 on your (Debian or Ubuntu) system and
>>> you
>>> should be good.
>>>
>>> Dirk
>>>
>>> --
>>> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>>>
>>
>> ______________________________________________
>> R-package-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>>
>>
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list