[Rd] new function to tools/utils package: dependencies based on DESCRIPTION file

2016-06-14 Thread Jan Górecki
Hi all,

Packages tools and utils have a lot of useful stuff for R developers.
I find one task still not as straightforward as it could. Simply to
extract dependencies of a package from DESCRIPTION file (before it is
even installed to library). This would be valuable in automation of CI
setup in a more meta-data driven way.
The simple function below, I know it is short and simple, but having
it to be defined in each CI workflow is a pain, it could be already
available in tools or utils namespace.

package.dependencies.dcf <- function(file = "DESCRIPTION", which =
c("Depends","Imports","LinkingTo")) {
stopifnot(file.exists(file), is.character(which))
which_all <- c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances")
if (identical(which, "all"))
which <- which_all
else if (identical(which, "most"))
which <- c("Depends", "Imports", "LinkingTo", "Suggests")
stopifnot(which %in% which_all)
dcf <- read.dcf(file, which)
# parse fields
raw.deps <- unlist(strsplit(dcf[!is.na(dcf)], ",", fixed = TRUE))
# strip stated dependency version
deps <- trimws(sapply(strsplit(trimws(raw.deps), "(", fixed =
TRUE), `[[`, 1L))
# exclude base R pkgs
base.pkgs <- c("R", rownames(installed.packages(priority = "base")))
setdiff(deps, base.pkgs)
}

This allows to easily install all package dependencies just based on
DESCRIPTION file, so simplify that in custom CI workflows to:

if (length(pkgs<-package.dependencies.dcf(which="all"))) install.packages(pkgs)

And would not require to install custom packages or shell scripts.

Regards,
Jan Gorecki

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] new function to tools/utils package: dependencies based on DESCRIPTION file

2016-06-14 Thread Thierry Onkelinx
Dear Jan,

Similar functionality is available in devtools::dev_package_deps()

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-06-14 16:54 GMT+02:00 Jan Górecki :

> Hi all,
>
> Packages tools and utils have a lot of useful stuff for R developers.
> I find one task still not as straightforward as it could. Simply to
> extract dependencies of a package from DESCRIPTION file (before it is
> even installed to library). This would be valuable in automation of CI
> setup in a more meta-data driven way.
> The simple function below, I know it is short and simple, but having
> it to be defined in each CI workflow is a pain, it could be already
> available in tools or utils namespace.
>
> package.dependencies.dcf <- function(file = "DESCRIPTION", which =
> c("Depends","Imports","LinkingTo")) {
> stopifnot(file.exists(file), is.character(which))
> which_all <- c("Depends", "Imports", "LinkingTo", "Suggests",
> "Enhances")
> if (identical(which, "all"))
> which <- which_all
> else if (identical(which, "most"))
> which <- c("Depends", "Imports", "LinkingTo", "Suggests")
> stopifnot(which %in% which_all)
> dcf <- read.dcf(file, which)
> # parse fields
> raw.deps <- unlist(strsplit(dcf[!is.na(dcf)], ",", fixed = TRUE))
> # strip stated dependency version
> deps <- trimws(sapply(strsplit(trimws(raw.deps), "(", fixed =
> TRUE), `[[`, 1L))
> # exclude base R pkgs
> base.pkgs <- c("R", rownames(installed.packages(priority = "base")))
> setdiff(deps, base.pkgs)
> }
>
> This allows to easily install all package dependencies just based on
> DESCRIPTION file, so simplify that in custom CI workflows to:
>
> if (length(pkgs<-package.dependencies.dcf(which="all")))
> install.packages(pkgs)
>
> And would not require to install custom packages or shell scripts.
>
> Regards,
> Jan Gorecki
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] getGraphicsEvent on X11 and event queuing

2016-06-14 Thread frederik
Hi Martin,

> Also, as you are studying the C code and the issues anyway, it
> may be worthwhile to consider (as small as possible!) patches to
> the source you could also post to the bugzilla site if you
> prefer; attaching as text/plain to R-devel does work fine, too.

Well, after your kind solicitation I went through all the touble of
locally fixing getGraphicsEvent Cairo support and implementing an
onIdle handler.

However, I noticed that the first part actually already has a patch on
the R bug tracker, which is exactly the same as the fix I implemented!
(minus documentation)

https://bugs.r-project.org/bugzilla/show_bug.cgi?id=14364

Problem: somebody ignored the patch and closed the bug. Who closed it?
YOU!

So, I guess since that patch (fixing Cairo support) was sent in 2010,
and my patch (fixing both problems) is about 8 times longer, I can
expect you to ignore my patch until at least 2063 (a tight lower bound
if you apply Hugo's patch this year). :)

I posted my patch here:

https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16951

Frederick

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] new function to tools/utils package: dependencies based on DESCRIPTION file

2016-06-14 Thread Jan Górecki
Hi Thierry,

I'm perfectly aware of it. Any idea when devtools would be shipped as
a base R package, or at least recommended package? To actually answer
the problem described in my email.
I have range of useful functions available tools/utils packages which
are shipped together with R. They doesn't require any OS dependencies
or R dependencies, unlike devtools which requires both. Installing
unnecessary OS dependencies and R dependencies just for such a simple
wrapper doesn't seem to be an elegant way to address it, therefore my
proposal to include that simple function in tools, or utils package.

Regards,
Jan Gorecki

On 14 June 2016 at 16:17, Thierry Onkelinx  wrote:
> Dear Jan,
>
> Similar functionality is available in devtools::dev_package_deps()
>
> Best regards,
>
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
> Forest
> team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
> Kliniekstraat 25
> 1070 Anderlecht
> Belgium
>
> To call in the statistician after the experiment is done may be no more than
> asking him to perform a post-mortem examination: he may be able to say what
> the experiment died of. ~ Sir Ronald Aylmer Fisher
> The plural of anecdote is not data. ~ Roger Brinner
> The combination of some data and an aching desire for an answer does not
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> 2016-06-14 16:54 GMT+02:00 Jan Górecki :
>>
>> Hi all,
>>
>> Packages tools and utils have a lot of useful stuff for R developers.
>> I find one task still not as straightforward as it could. Simply to
>> extract dependencies of a package from DESCRIPTION file (before it is
>> even installed to library). This would be valuable in automation of CI
>> setup in a more meta-data driven way.
>> The simple function below, I know it is short and simple, but having
>> it to be defined in each CI workflow is a pain, it could be already
>> available in tools or utils namespace.
>>
>> package.dependencies.dcf <- function(file = "DESCRIPTION", which =
>> c("Depends","Imports","LinkingTo")) {
>> stopifnot(file.exists(file), is.character(which))
>> which_all <- c("Depends", "Imports", "LinkingTo", "Suggests",
>> "Enhances")
>> if (identical(which, "all"))
>> which <- which_all
>> else if (identical(which, "most"))
>> which <- c("Depends", "Imports", "LinkingTo", "Suggests")
>> stopifnot(which %in% which_all)
>> dcf <- read.dcf(file, which)
>> # parse fields
>> raw.deps <- unlist(strsplit(dcf[!is.na(dcf)], ",", fixed = TRUE))
>> # strip stated dependency version
>> deps <- trimws(sapply(strsplit(trimws(raw.deps), "(", fixed =
>> TRUE), `[[`, 1L))
>> # exclude base R pkgs
>> base.pkgs <- c("R", rownames(installed.packages(priority = "base")))
>> setdiff(deps, base.pkgs)
>> }
>>
>> This allows to easily install all package dependencies just based on
>> DESCRIPTION file, so simplify that in custom CI workflows to:
>>
>> if (length(pkgs<-package.dependencies.dcf(which="all")))
>> install.packages(pkgs)
>>
>> And would not require to install custom packages or shell scripts.
>>
>> Regards,
>> Jan Gorecki
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel