Am Donnerstag, 7. März 2013 schrieb Cyril Roelandt:
> From setup.py:
> # those are examined to find
> # - libxml2/libxml/tree.h
> # - iconv.h
> # - libxslt/xsltconfig.h
> includes_dir = [
> "/usr/include",
> "/usr/local/include",
> "/opt/include",
> os.path.join(ROOT,'include'),
> HOME
> ];
>
> You could patch setup.py to add the right path. Or you could run
> "configure" in libxml2 with "--prefix=<yourprefix>", then cd into the
> "python" directory, and ROOT will be set to <youprefix> in setup.py.
Thanks for your help! Indeed, when running "setup.py install" from the guix
builder, libxml2 is found after installing it, so the "--prefix" is
honoured. However, then iconv.h is searched for in the given list of paths,
which does not include /nix/store/...glibc.../include, and the CPATH is not
taken into account, so iconv.h is not found.
I tried adding glibc as an explicit input and to overwrite the path in
setup.py. However, that does not use the glibc of the CPATH, but builds
another one on top of it. Do I understand it correctly that I need to use
glibc-final instead?
> Try:
> $ python setup.py install --prefix=/path/to/foo/bar
> You may have to adjust $PYTHONPATH to something like:
> /path/to/foo/bar:$PYTHONPATH
> for this to work.
Specifying no --prefix, it now tries to install a file as
/nix/store/j8f28wavspyic8g9didl1ninaz48vdq0-
python-2.7.3/lib/python2.7/site-packages/libxml2mod.so
which fails since this is another package, not libxml2.
Giving as --prefix the output path, files are instead installed into
/nix/store/svnw8fq87qrfrpcs7grx5nram558ahkp-
libxml2-2.9.0/lib/python2.7/site-packages/
which looks reasonable.
I am attaching the resulting patch. Is it reasonable to apply it to the
libxml2 package, or would it be preferable to create a separate libxml2-
python package?
Andreas
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index b3c5f7d..0a47f35 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -19,6 +19,8 @@
(define-module (gnu packages xml)
#:use-module (gnu packages)
+ #:use-module (gnu packages base)
+ #:use-module (gnu packages compression)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages perl)
#:use-module (gnu packages python)
@@ -64,7 +66,22 @@ things the parser might find in the XML document (like start tags).")
(home-page "http://www.xmlsoft.org/")
(synopsis "libxml2, a C parser for XML")
(inputs `(("perl" ,perl)
- ("python" ,python)))
+ ("python" ,python)
+ ("zlib" ,zlib)
+ ("glibc" ,glibc-final)))
+ (arguments
+ `(#:phases
+ (alist-replace
+ 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys #:rest args)
+ (let ((install (assoc-ref %standard-phases 'install))
+ (glibc (assoc-ref inputs "glibc"))
+ (out (assoc-ref outputs "out")))
+ (apply install args)
+ (chdir "python")
+ (substitute* "setup.py" (("/opt/include") (string-append glibc "/include")))
+ (system* "python" "setup.py" "install" (string-append "--prefix=" out))))
+ %standard-phases)))
(description
"Libxml2 is the XML C parser and toolkit developed for the Gnome project
(but it is usable outside of the Gnome platform).")