From: Cyril Roelandt <tipecaml@gmail.com>
To: guix-devel@gnu.org
Subject: [PATCH 2/5] gnu: Python: use /nix/.../sh if /bin/sh cannot be found
Date: Fri, 7 Mar 2014 03:47:32 +0100 [thread overview]
Message-ID: <1394160455-32580-3-git-send-email-tipecaml@gmail.com> (raw)
In-Reply-To: <1394160455-32580-1-git-send-email-tipecaml@gmail.com>
* 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
next prev parent reply other threads:[~2014-03-07 2:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 2:47 [PATCH 0/5] Python improvements Cyril Roelandt
2014-03-07 2:47 ` [PATCH 1/5] gnu: Enable the 'ctypes' module in Python Cyril Roelandt
2014-03-07 9:28 ` Ludovic Courtès
2014-03-07 2:47 ` Cyril Roelandt [this message]
2014-03-07 9:31 ` [PATCH 2/5] gnu: Python: use /nix/.../sh if /bin/sh cannot be found Ludovic Courtès
2014-03-22 3:36 ` [PATCH 2/4 v2] gnu: Python: use /nix/.../sh instead of /bin/sh in the subprocess module Cyril Roelandt
2014-03-22 14:26 ` Ludovic Courtès
2014-03-07 2:47 ` [PATCH 3/5] gnu: Enable tests in Python 3 Cyril Roelandt
2014-03-07 9:40 ` Ludovic Courtès
2014-03-21 4:12 ` [PATCH 3/4 v2] " Cyril Roelandt
2014-03-22 14:32 ` Ludovic Courtès
2014-03-21 4:14 ` [PATCH 3/5] " Cyril Roelandt
2014-03-21 13:15 ` Ludovic Courtès
2014-03-22 23:13 ` Cyril Roelandt
2014-03-23 10:43 ` Ludovic Courtès
2014-03-07 2:47 ` [PATCH 4/5] gnu: Python: bump to 3.3.4 Cyril Roelandt
2014-03-07 9:31 ` Ludovic Courtès
2014-03-21 4:07 ` Cyril Roelandt
2014-03-21 13:02 ` Ludovic Courtès
2014-03-07 2:47 ` [PATCH 5/5] gnu: remove python-fix-dbm.patch Cyril Roelandt
2014-03-07 9:32 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394160455-32580-3-git-send-email-tipecaml@gmail.com \
--to=tipecaml@gmail.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.