From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) 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 Message-ID: <87fvmubbiv.fsf@gnu.org> References: <1394160455-32580-1-git-send-email-tipecaml@gmail.com> <1394160455-32580-3-git-send-email-tipecaml@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLr7p-0006ow-Jj for guix-devel@gnu.org; Fri, 07 Mar 2014 04:31:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLr7i-0006NM-Ev for guix-devel@gnu.org; Fri, 07 Mar 2014 04:31:29 -0500 Received: from hera.aquilenet.fr ([2a01:474::1]:51625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLr7i-0006NC-8H for guix-devel@gnu.org; Fri, 07 Mar 2014 04:31:22 -0500 In-Reply-To: <1394160455-32580-3-git-send-email-tipecaml@gmail.com> (Cyril Roelandt's message of "Fri, 7 Mar 2014 03:47:32 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Cyril Roelandt Cc: guix-devel@gnu.org Cyril Roelandt 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 ch= root) > --- > 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 =3D \\[\"/bin/sh") > + (string-append > + "args =3D [\"/bin/sh\" if os.path.exists(\"/bin/sh\") e= lse " > + "\"" (which "sh")))) > + (apply configure args))) I=E2=80=99m 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=E2=80=99s what we=E2=80=99d guarantee by = explicitly using the build-time (which "sh"). Fine with you? Thanks, Ludo=E2=80=99.