tools::package_dependencies problems

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

tools::package_dependencies problems

Spencer Graves-3
Hello, All:


          tools::package_dependencies('Ecfun') failed to find how my
development version of Ecfun was using rJava, which generated errors in
"R CMD build Ecfun".  This is because package_dependencies by default
uses CRAN and ignores locally installed packages.


          What do you think about having this function check both locally
installed and CRAN versions?


          It can probably be done, but I don't see how at the moment.


          Also, the traditional interpretation of a help file with Usage
including an argument 'which = c("Depends", "Imports", "LinkingTo")' is
that specifying nothing defaults to "Depends".  In this case, it
defaults to "Imports".  Moreover, I don't see a way to trace "Suggests".


          ???
          Thanks,
          Spencer Graves

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: tools::package_dependencies problems

Gabriel Becker-2
Hi Spencer,

You just need an available.packages matrix which reflects the reality you
want to test against. There are probably various ways of getting one of
these, but switchr allows you to build repositories off of many things
including local directories, so you could do something like

> setwd('/Users/gabrielbecker/gabe/checkedout/rtables/')
> library(switchr)
> chooseCRANmirror(ind = 1L)
> crancontribs = contrib.url(options()$repos)
> man = PkgManifest(name = "switchr", url = "~/gabe/checkedout/switchr",
type = "local")
> loccontrib <- lazyRepo(man)

> avl = available.packages(c(loccontrib, crancontribs))
> head(avl[, c("Package", "Version", "Repository")])
         Package    Version
switchr  "switchr"  "0.14.3"
A3       "A3"       "1.0.0"
aaSEA    "aaSEA"    "1.1.0"
AATtools "AATtools" "0.0.1"
ABACUS   "ABACUS"   "1.0.0"
abbyyR   "abbyyR"   "0.5.5"
         Repository

switchr
 "file:///var/folders/14/z0rjkn8j0n5dj1lkdd4ng1600000gn/T/Rtmpe1zsSL/repo/src/contrib"
A3       "https://cloud.r-project.org/src/contrib"

aaSEA    "https://cloud.r-project.org/src/contrib"

AATtools "https://cloud.r-project.org/src/contrib"

ABACUS   "https://cloud.r-project.org/src/contrib"

abbyyR   "https://cloud.r-project.org/src/contrib"

And pass avl directly to package_dependencies


> tools::package_dependencies("switchr", db = avl)
$switchr
[1] "methods" "tools"   "RJSONIO" "RCurl"

The benefit here beyond just constructing the PACKAGES file for your one
package (which if you want to get clever is all available.packages is
actually going to need) is that switchr will allow you to install it if you
want as well. switchr also allows you to install from your local working
copies of multiple inter-related packages simultaneously by having a
manifest that has those working copies in it, if you are doing development
that crosses package boundaries.


This reminds me that I need to polish and push some utilities related to
local checkouts of packages, I'll try to do that soon.

Anyway, hope that helps as it is now,

Best,
~G

On Fri, Oct 16, 2020 at 3:28 PM Spencer Graves <[hidden email]>
wrote:

> Hello, All:
>
>
>           tools::package_dependencies('Ecfun') failed to find how my
> development version of Ecfun was using rJava, which generated errors in
> "R CMD build Ecfun".  This is because package_dependencies by default
> uses CRAN and ignores locally installed packages.
>
>
>           What do you think about having this function check both locally
> installed and CRAN versions?
>
>
>           It can probably be done, but I don't see how at the moment.
>
>
>           Also, the traditional interpretation of a help file with Usage
> including an argument 'which = c("Depends", "Imports", "LinkingTo")' is
> that specifying nothing defaults to "Depends".  In this case, it
> defaults to "Imports".  Moreover, I don't see a way to trace "Suggests".
>
>
>           ???
>           Thanks,
>           Spencer Graves
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: tools::package_dependencies problems

Bill Dunlap-2
In reply to this post by Spencer Graves-3
Have you tried using the 'db' argument to tools::package_dependencies?
rbind the common columns of installed.packages() and available.packages()
and use that as the package database.
    installed <- installed.packages()
    available <- available.packages()
    commonCols <- intersect(colnames(installed),colnames(available))
    db <- rbind(installed[commonCols,], available[commonCols,])
    tools::package_dependencies("somePkg", db=db)

List the types of dependencies you want in the 'which' argument, e.g.
which=c("Depends","Imports","LinkingTo","Suggests").

In R-devel now (but not R-4.0.2 and I haven't downloaded 4.0.3 yet) you can
use nicknames for which ("strong"=DIL, "most"="strong"+"Suggests", or
"all"="most"+"Enhances") and can also use recursive=columnNames to use a
smaller set of columns when recursing.  Recursing with "Suggests" or
"Enhances" can give you a huge number of usually irrelevant packages.

On Fri, Oct 16, 2020 at 3:28 PM Spencer Graves <[hidden email]>
wrote:

> Hello, All:
>
>
>           tools::package_dependencies('Ecfun') failed to find how my
> development version of Ecfun was using rJava, which generated errors in
> "R CMD build Ecfun".  This is because package_dependencies by default
> uses CRAN and ignores locally installed packages.
>
>
>           What do you think about having this function check both locally
> installed and CRAN versions?
>
>
>           It can probably be done, but I don't see how at the moment.
>
>
>           Also, the traditional interpretation of a help file with Usage
> including an argument 'which = c("Depends", "Imports", "LinkingTo")' is
> that specifying nothing defaults to "Depends".  In this case, it
> defaults to "Imports".  Moreover, I don't see a way to trace "Suggests".
>
>
>           ???
>           Thanks,
>           Spencer Graves
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel