From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: [PATCH 2/5] gnu: Python: use /nix/.../sh if /bin/sh cannot be found Date: Fri, 7 Mar 2014 03:47:32 +0100 Message-ID: <1394160455-32580-3-git-send-email-tipecaml@gmail.com> References: <1394160455-32580-1-git-send-email-tipecaml@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLkv0-0007bL-Gq for guix-devel@gnu.org; Thu, 06 Mar 2014 21:53:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLkut-00074S-UI for guix-devel@gnu.org; Thu, 06 Mar 2014 21:53:50 -0500 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]:62927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLkut-00072c-N9 for guix-devel@gnu.org; Thu, 06 Mar 2014 21:53:43 -0500 Received: by mail-wg0-f50.google.com with SMTP id x13so4273326wgg.21 for ; Thu, 06 Mar 2014 18:53:42 -0800 (PST) In-Reply-To: <1394160455-32580-1-git-send-email-tipecaml@gmail.com> 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: guix-devel@gnu.org * 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))) + %standard-phases)))) (inputs `(("bzip2" ,bzip2) ("gdbm" ,gdbm) -- 1.8.4.rc3