guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/5] gnu: Python: use /nix/.../sh if /bin/sh cannot be found


From: Ludovic Courtès
Subject: Re: [PATCH 2/5] gnu: Python: use /nix/.../sh if /bin/sh cannot be found
Date: Fri, 07 Mar 2014 10:31:20 +0100
User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)

Cyril Roelandt <address@hidden> skribis:

> * gnu/packages/python.scm (python-2): patch Lib/subprocess.py to use
>   /nix/.../sh when /bin/sh is not available (most of the time, in Guix chroot)
> ---
>  gnu/packages/python.scm | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
> index 8f92dc2..a663b5e 100644
> --- a/gnu/packages/python.scm
> +++ b/gnu/packages/python.scm
> @@ -138,7 +138,24 @@
>               (with-directory-excursion out
>                 (for-each (cut augment-rpath <> lib)
>                           (find-files "bin" ".*")))))
> -         %standard-phases)))
> +         (alist-replace
> +          'configure
> +          (lambda* (#:key outputs #:allow-other-keys #:rest args)
> +            (let ((configure (assoc-ref %standard-phases 'configure)))
> +             ;; Some libraries try to call subprocess.Popen(), which uses
> +             ;; /bin/sh, in their tests. Since /bin/sh is not available in 
> the
> +             ;; chroot, the tests fail. Instead of disabling them, add
> +             ;; '/nix/.../sh' as an alternative shell. The default shell is
> +             ;; still /bin/sh, so the subprocess module works exactly as
> +             ;; expected. The extra 'if' condition will slow down things, but
> +             ;; not enough to be noticed.
> +             (substitute* "Lib/subprocess.py"
> +               (("args = \\[\"/bin/sh")
> +                (string-append
> +                 "args = [\"/bin/sh\" if os.path.exists(\"/bin/sh\") else "
> +                 "\"" (which "sh"))))
> +             (apply configure args)))

I’m in favor of just (which "sh").

As discussed on IRC, all one can expect from /bin/sh is to point to a
Bourne-compatible shell, and that’s what we’d guarantee by explicitly
using the build-time (which "sh").

Fine with you?

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]