all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: r: Add which to propagated-inputs.
@ 2017-01-23 21:01 Raoul Bonnal
  2017-01-24 21:04 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Raoul Bonnal @ 2017-01-23 21:01 UTC (permalink / raw)
  To: guix-devel

From: Raoul Jean Pierre Bonnal <ilpuccio.febo@gmail.com>

* gnu/packages/statistics.scm (r)[propagated-inputs]: Add which.
---

Notes:
    In my local installation of R
    
    Sys.which(c("bash"))
    
    was not working properly, inspecting the function(below) I had not installed which beforehand.
    > Sys.which
    function (names)
    {
        res <- character(length(names))
        names(res) <- names
        which <- "/gnu/store/cn670s29lsf2nr5axd8gmhl8sb9qpyiq-which-2.21/bin/which"
        if (!nzchar(which)) {
            warning("'which' was not found on this platform")
            return(res)
        }
        for (i in seq_along(names)) {
            if (is.na(names[i])) {
                res[i] <- NA
                next
            }
            ans <- suppressWarnings(system(paste(which, shQuote(names[i])),
                intern = TRUE, ignore.stderr = TRUE))
            if (grepl("solaris", R.version$os)) {
                tmp <- strsplit(ans[1], " ", fixed = TRUE)[[1]]
                if (identical(tmp[1:3], c("no", i, "in")))
                    ans <- ""
            }
            res[i] <- if (length(ans))
                ans[1]
            else ""
            if (!file.exists(res[i]))
                res[i] <- ""
        }
        res
    }
    
    requiring which to be installed along with R seems to fix the issue.

 gnu/packages/statistics.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index f27cb5704..648825b1e 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -191,6 +191,8 @@ be output in text, PostScript, PDF or HTML.")
        ("pcre" ,pcre)
        ("readline" ,readline)
        ("zlib" ,zlib)))
+    (propagated-inputs
+     `(("which" ,which)))
     (native-search-paths
      (list (search-path-specification
             (variable "R_LIBS_SITE")
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: r: Add which to propagated-inputs.
  2017-01-23 21:01 [PATCH] gnu: r: Add which to propagated-inputs Raoul Bonnal
@ 2017-01-24 21:04 ` Ludovic Courtès
  2017-01-24 21:54   ` Ra
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2017-01-24 21:04 UTC (permalink / raw)
  To: Raoul Bonnal; +Cc: guix-devel

Hi,

Raoul Bonnal <ilpuccio.febo@gmail.com> skribis:

> From: Raoul Jean Pierre Bonnal <ilpuccio.febo@gmail.com>
>
> * gnu/packages/statistics.scm (r)[propagated-inputs]: Add which.
> ---
>
> Notes:
>     In my local installation of R
>     
>     Sys.which(c("bash"))
>     
>     was not working properly, inspecting the function(below) I had not installed which beforehand.
>     > Sys.which
>     function (names)
>     {
>         res <- character(length(names))
>         names(res) <- names
>         which <- "/gnu/store/cn670s29lsf2nr5axd8gmhl8sb9qpyiq-which-2.21/bin/which"

This function contains the absolute file name of ‘which’, so everything
should work?

Doing this (modifying the code to refer to external commands by absolute
file names) is preferable over propagating inputs, because it avoids
clobbering user profiles.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: r: Add which to propagated-inputs.
  2017-01-24 21:04 ` Ludovic Courtès
@ 2017-01-24 21:54   ` Ra
  0 siblings, 0 replies; 3+ messages in thread
From: Ra @ 2017-01-24 21:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1123 bytes --]

Hi Ludo,

On Tue, Jan 24, 2017 at 10:04 PM Ludovic Courtès <ludo@gnu.org> wrote:

Hi,

Raoul Bonnal <ilpuccio.febo@gmail.com> skribis:

> From: Raoul Jean Pierre Bonnal <ilpuccio.febo@gmail.com>
>
> * gnu/packages/statistics.scm (r)[propagated-inputs]: Add which.
> ---
>
> Notes:
>     In my local installation of R
>
>     Sys.which(c("bash"))
>
>     was not working properly, inspecting the function(below) I had not
installed which beforehand.
>     > Sys.which
>     function (names)
>     {
>         res <- character(length(names))
>         names(res) <- names
>         which <-
"/gnu/store/cn670s29lsf2nr5axd8gmhl8sb9qpyiq-which-2.21/bin/which"

This function contains the absolute file name of ‘which’, so everything
should work?


That is what I expected. The R function was not working till I explicitly
installed the package 'which', maybe it was something strange on my side.


Doing this (modifying the code to refer to external commands by absolute
file names) is preferable over propagating inputs, because it avoids
clobbering user profiles.


Thanks.
Ra

[-- Attachment #2: Type: text/html, Size: 2611 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-24 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-23 21:01 [PATCH] gnu: r: Add which to propagated-inputs Raoul Bonnal
2017-01-24 21:04 ` Ludovic Courtès
2017-01-24 21:54   ` Ra

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.