unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andreas Enge <andreas@enge.fr>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: Python-build-system does not honour phases
Date: Tue, 10 Sep 2013 15:28:36 +0200	[thread overview]
Message-ID: <20130910132836.GA4248@debian> (raw)
In-Reply-To: <20130910082655.GA8621@debian>

[-- Attachment #1: Type: text/plain, Size: 2086 bytes --]

On Tue, Sep 10, 2013 at 10:26:55AM +0200, Andreas Enge wrote:
> Maybe we should try to use a variable name %python-standard-phases instead.

The attached patch to guix/build/python-build-system.scm does just this
and works. Would it make sense to push it?

The part of the patch adding python-setuptools is not finished yet.
Installation ends with the contradictory error message

running install
Checking .pth file support in /nix/store/dwfvjk9rii9xyshfd6snny590a82bbfq-python-setuptools-1.1.4/lib/python3.3/site-packages/
/nix/store/fqg4h8afvnh7c0l2pqrid0wsjldp03sh-python-wrapper-3.3.2/bin/python -E -c pass
TEST FAILED: /nix/store/dwfvjk9rii9xyshfd6snny590a82bbfq-python-setuptools-1.1.4/lib/python3.3/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /nix/store/dwfvjk9rii9xyshfd6snny590a82bbfq-python-setuptools-1.1.4/lib/python3.3/site-packages/

and your PYTHONPATH environment variable currently contains:

    '/nix/store/dwfvjk9rii9xyshfd6snny590a82bbfq-python-setuptools-1.1.4/lib/python3.3/site/packages/'

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations

Please make the appropriate changes for your system and try again.


From what I can tell, I followed exactly the second approach. 

Does any of the python specialists understand what is happening?

Andreas


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3395 bytes --]

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 3ff4da2..a8f8c9d 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -247,3 +247,44 @@ etc. ")
 
 (define-public python2-babel
   (package-with-python2 python-babel))
+
+(define-public python-setuptools
+  (package
+    (name "python-setuptools")
+    (version "1.1.4")
+    (source
+     (origin
+      (method url-fetch)
+      (uri (string-append "https://pypi.python.org/packages/source/s/setuptools/setuptools-"
+                          version ".tar.gz"))
+      (sha256
+       (base32
+        "0hl9sa5xr9bi2ifq51wy1bawsjv5nzvpbac7m9z1ciz778874csf"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f ; FIXME: try to run tests
+       #:phases
+         (alist-replace
+          'install
+          (lambda* (#:key outputs #:allow-other-keys #:rest args)
+            (let* ((install (assoc-ref %python-standard-phases 'install))
+                   (out (assoc-ref outputs "out"))
+                   (path (string-append out "/lib/python3.3/site/packages/")))
+              (mkdir-p path)
+              (setenv "PYTHONPATH" path)
+              (format #t "XXX ~a XXX~%" (getenv "PYTHONPATH"))
+              (apply install args)))
+          %python-standard-phases)))
+    (home-page "https://pypi.python.org/pypi/setuptools")
+    (synopsis
+     "Library designed to facilitate packaging Python projects")
+    (description
+     "Setuptools is a fully-featured, stable library designed to facilitate
+packaging Python projects, where packaging includes:
+Python package and module definitions,
+distribution package metadata,
+test hooks,
+project installation,
+platform-specific details,
+Python 3 support.")
+    (license psfl)))
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index f213a97..14cd086 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -19,14 +19,13 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (guix build python-build-system)
-  #:use-module ((guix build gnu-build-system)
-                #:renamer (symbol-prefix-proc 'gnu:))
+  #:use-module (guix build gnu-build-system)
   #:use-module (guix build utils)
   #:use-module (ice-9 match)
   #:use-module (ice-9 ftw)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
-  #:export (%standard-phases
+  #:export (%python-standard-phases
             python-build))
 
 ;; Commentary:
@@ -91,7 +90,7 @@
                             files)))
               bindirs)))
 
-(define %standard-phases
+(define %python-standard-phases
   ;; 'configure' and 'build' phases are not needed.  Everything is done during
   ;; 'install'.
   (alist-cons-after
@@ -103,11 +102,11 @@
      'check check
      (alist-replace 'install install
                     (alist-delete 'configure
-                                               gnu:%standard-phases))))))
+                                  %standard-phases))))))
 
 (define* (python-build #:key inputs (phases %standard-phases)
                        #:allow-other-keys #:rest args)
   "Build the given Python package, applying all of PHASES in order."
-  (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+  (apply gnu-build #:inputs inputs #:phases phases args))
 
 ;;; python-build-system.scm ends here

  reply	other threads:[~2013-09-10 13:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-07 22:26 Python-build-system does not honour phases Andreas Enge
2013-09-09 21:35 ` Ludovic Courtès
2013-09-10  8:26   ` Andreas Enge
2013-09-10 13:28     ` Andreas Enge [this message]
2013-09-10 17:53       ` Ludovic Courtès
2013-09-10 19:07         ` Andreas Enge
2013-09-10 19:27           ` Andreas Enge
2013-09-10 21:20             ` Ludovic Courtès
2013-09-10 21:34               ` Andreas Enge
2013-09-11 13:55                 ` Andreas Enge
2013-09-11 17:45                   ` Ludovic Courtès
2013-09-10 17:48     ` Ludovic Courtès
2013-09-10 18:31       ` Andreas Enge
2013-09-10 21:18         ` 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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130910132836.GA4248@debian \
    --to=andreas@enge.fr \
    --cc=guix-devel@gnu.org \
    --cc=ludo@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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).