all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Cyril Roelandt <tipecaml@gmail.com>
To: bug-guix@gnu.org
Subject: [PATCH] gnu: Fix zlib support in Python.
Date: Wed,  3 Apr 2013 23:33:29 +0200	[thread overview]
Message-ID: <1365024809-18782-1-git-send-email-tipecaml@gmail.com> (raw)
In-Reply-To: <87zjxgqaei.fsf@gnu.org>

We must adjust 'inc_dirs' and 'lib_dirs' in setup.py.
---
On 04/03/2013 10:35 AM, Ludovic Courtès wrote:
> Can you strace it to see which zlib gets loaded?

Well, this is funny. When running "python -c "import zlib", /usr/bin/python is
called:

execve("/home/cyril/.guix-profile/bin/python", ["python", "-c", "import zlib"], [/* 23 vars */]) = 0

I had to use an absolute path to run the right interpreter:

execve("/home/cyril/.guix-profile/bin/python", ["/home/cyril/.guix-profile/bin/py"..., "-c", "import zlib"], [/* 23 vars */]) = 0

and it fails to load zlib.


Anyway, I think the zlib module was not found because setup.py only looks for
the libraries/headers in a few hardcoded directories

        lib_dirs = self.compiler.library_dirs + [
            '/lib64', '/usr/lib64',
            '/lib', '/usr/lib',
            ]
        inc_dirs = self.compiler.include_dirs + ['/usr/include']


Could you confirm that:
1) This patch fixes your zlib issues
2) A similar error occurs when importing other modules, such as bz2

?

I do not think there is a more elegant solution than patching setup.py. I tried
running "CFLAGS=-I/path/to/zlib/include ./configure" and
"CFLAGS=-I/path/to/zlib/include make" but it does not seem to make any
difference.


Cyril.


 gnu/packages/python.scm |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 52b11e4..505dcd9 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -38,7 +38,22 @@
        (base32
         "11f9aw855lrmknr6c82gm1ijr3n0smc6idyp94y7774yivjnplv1"))))
     (build-system gnu-build-system)
-    (arguments `(#:tests? #f)) ; XXX: some tests fail
+    (arguments
+     `(#:tests? #f ; XXX: some tests fail
+       #:phases
+       (alist-replace
+        'configure
+        (lambda* (#:key inputs #:allow-other-keys #:rest args)
+          (let ((configure (assoc-ref %standard-phases 'configure))
+                (zlib (assoc-ref inputs "zlib")))
+            (substitute* "setup.py"
+              (("'/lib64', '/usr/lib64'")
+               (string-append "'" zlib "/lib'")))
+            (substitute* "setup.py"
+              (("\\['/usr/include'\\]")
+               (string-append "['" zlib "/include']")))
+            (apply configure args)))
+        %standard-phases)))
     (inputs
      `(("zlib" ,zlib)
        ("openssl" ,openssl)
-- 
1.7.10.4

  reply	other threads:[~2013-04-03 21:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 14:32 Python: Zlib support Nikita Karetnikov
2013-04-02 18:25 ` Cyril Roelandt
2013-04-03  4:00   ` Nikita Karetnikov
2013-04-03  8:35   ` Ludovic Courtès
2013-04-03 21:33     ` Cyril Roelandt [this message]
2013-04-04  8:12       ` [PATCH] gnu: Fix zlib support in Python Nikita Karetnikov
2013-04-05 22:45         ` [PATCH] gnu: Python: fix the compilation of some modules from the standard library Cyril Roelandt
2013-04-06 14:09           ` Ludovic Courtès
2013-04-06 18:48             ` [PATCH] gnu: Python: enable the dbm module Cyril Roelandt
2013-04-06 22:39               ` Ludovic Courtès
2013-04-07 14:11                 ` [PATCH] gnu: Python: fix the compilation of some modules from the standard library Cyril Roelandt
2013-04-07 14:29                   ` Ludovic Courtès
2013-04-15 20:39                   ` [PATCH] gnu: Python: bump to version 2.7.4 Cyril Roelandt
2013-04-15 21:47                     ` 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=1365024809-18782-1-git-send-email-tipecaml@gmail.com \
    --to=tipecaml@gmail.com \
    --cc=bug-guix@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.