From 3df47231e6c632aadcd7b103bb5b399a8d29772d Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Wed, 4 Sep 2013 18:04:15 +0200 Subject: guix: python: Switch to python-wrapper as the default version for the python build system (switches to Python 3) and compute python-version instead of passing it as a parameter. * guix/build-system/python.scm (default-python): Switch to python-wrapper. * guix/build-system/python.scm (python-build): Drop parameter #:python-version. * guix/build/python-build-system.scm (wrap): Compute python version from input. --- guix/build/python-build-system.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'guix/build') diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index 84299798b0..04c223bb85 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -53,7 +53,7 @@ (define* (check #:key outputs #:allow-other-keys) (zero? (apply system* "python" args))) (error "no setup.py found"))) -(define* (wrap #:key outputs python-version #:allow-other-keys) +(define* (wrap #:key inputs outputs #:allow-other-keys) (define (list-of-files dir) (map (cut string-append dir "/" <>) (or (scandir dir (lambda (f) @@ -69,6 +69,8 @@ (define bindirs outputs)) (let* ((out (assoc-ref outputs "out")) + (python (assoc-ref inputs "python")) + (python-version (string-take (string-take-right python 5) 3)) (var `("PYTHONPATH" prefix ,(cons (string-append out "/lib/python" python-version "/site-packages") -- cgit v1.2.3 From 7b96bf82daf25699ce6b4f4cb2ced1e5318b576f Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Thu, 5 Sep 2013 18:43:18 +0200 Subject: gnu: python: Honour #:tests? and #:test-target in build system. * guix/build/python-build-system.scm (check): Use named parameters tests? and test-target (default now: "test" instead of "check"). --- guix/build/python-build-system.scm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'guix/build') diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index 04c223bb85..27818526fa 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013 Ludovic Courtès +;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2013 Nikita Karetnikov ;;; ;;; This file is part of GNU Guix. @@ -45,13 +46,15 @@ (define* (install #:key outputs (configure-flags '()) (zero? (apply system* "python" args))) (error "no setup.py found")))) -(define* (check #:key outputs #:allow-other-keys) +(define* (check #:key outputs tests? test-target #:allow-other-keys) "Run the test suite of a given Python package." - (if (file-exists? "setup.py") - (let ((args `("setup.py" "check"))) - (format #t "running 'python' with arguments ~s~%" args) - (zero? (apply system* "python" args))) - (error "no setup.py found"))) + (if tests? + (if (file-exists? "setup.py") + (let ((args `("setup.py" ,test-target))) + (format #t "running 'python' with arguments ~s~%" args) + (zero? (apply system* "python" args))) + (error "no setup.py found")) + #t)) (define* (wrap #:key inputs outputs #:allow-other-keys) (define (list-of-files dir) -- cgit v1.2.3 From b191f88ee34576a6908b9b5e94cb7664e88c7e79 Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Thu, 5 Sep 2013 20:25:08 +0200 Subject: guix: python: Add build phase and factor out calls to setup.py. * guix/build/python-build-system.scm (call-setuppy): New procedure. * guix/build/python-build-system.scm (build): New procedure. * guix/build/python-build-system.scm (check, install): Use call-setuppy. * guix/build/python-build-system.scm (%standard-phases): Add call to build. --- guix/build/python-build-system.scm | 49 ++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'guix/build') diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index 27818526fa..f213a97f01 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -35,27 +35,33 @@ (define-module (guix build python-build-system) ;; ;; Code: -(define* (install #:key outputs (configure-flags '()) - #:allow-other-keys) - "Install a given Python package." - (let ((out (assoc-ref outputs "out"))) - (if (file-exists? "setup.py") - (let ((args `("setup.py" "install" ,(string-append "--prefix=" out) - ,@configure-flags))) - (format #t "running 'python' with arguments ~s~%" args) - (zero? (apply system* "python" args))) - (error "no setup.py found")))) -(define* (check #:key outputs tests? test-target #:allow-other-keys) +(define (call-setuppy command params) + (if (file-exists? "setup.py") + (begin + (format #t "running \"python setup.py\" with command ~s and parameters ~s~%" + command params) + (zero? (apply system* "python" "setup.py" command params))) + (error "no setup.py found"))) + +(define* (build #:rest empty) + "Build a given Python package." + (call-setuppy "build" '())) + +(define* (check #:key tests? test-target #:allow-other-keys) "Run the test suite of a given Python package." (if tests? - (if (file-exists? "setup.py") - (let ((args `("setup.py" ,test-target))) - (format #t "running 'python' with arguments ~s~%" args) - (zero? (apply system* "python" args))) - (error "no setup.py found")) + (call-setuppy test-target '()) #t)) +(define* (install #:key outputs (configure-flags '()) + #:allow-other-keys) + "Install a given Python package." + (let* ((out (assoc-ref outputs "out")) + (params (append (list (string-append "--prefix=" out)) + configure-flags))) + (call-setuppy "install" params))) + (define* (wrap #:key inputs outputs #:allow-other-keys) (define (list-of-files dir) (map (cut string-append dir "/" <>) @@ -92,11 +98,12 @@ (define %standard-phases 'install 'wrap wrap (alist-replace - 'check check - (alist-replace 'install install - (alist-delete 'configure - (alist-delete 'build - gnu:%standard-phases)))))) + 'build build + (alist-replace + 'check check + (alist-replace 'install install + (alist-delete 'configure + gnu:%standard-phases)))))) (define* (python-build #:key inputs (phases %standard-phases) #:allow-other-keys #:rest args) -- cgit v1.2.3 From 37c825eb79e18ac61080e626db6cff6552fd5cf4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 11 Sep 2013 00:52:36 +0200 Subject: linux-initrd: Create /dev/klog and /dev/kmsg. * guix/build/linux-initrd.scm (make-essential-device-nodes): Make /dev/klog and /dev/kmsg. --- guix/build/linux-initrd.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'guix/build') diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm index b5404da7f0..cbdb363b4e 100644 --- a/guix/build/linux-initrd.scm +++ b/guix/build/linux-initrd.scm @@ -89,6 +89,10 @@ (define (scope dir) (device-number 4 n)) (loop (+ 1 n))))) + ;; Rendez-vous point for syslogd. + (mknod (scope "dev/log") 'socket #o666 0) + (mknod (scope "dev/kmsg") 'char-special #o600 (device-number 1 11)) + ;; Other useful nodes. (mknod (scope "dev/null") 'char-special #o666 (device-number 1 3)) (mknod (scope "dev/zero") 'char-special #o666 (device-number 1 5))) -- cgit v1.2.3 From 824af8cadc1b4f1ac7a859f3d18cbe69b195a844 Mon Sep 17 00:00:00 2001 From: Andreas Enge Date: Wed, 11 Sep 2013 15:47:34 +0200 Subject: guix: python: Create module installation path and add it to PYTHONPATH during the installation phase. * guix/build/python-build-system.scm (get-python-version): New procedure. * guix/build/python-build-system.scm (install): Create and add path. * gnu/packages/python.scm (python-setuptools): Drop path creation code. --- gnu/packages/python.scm | 16 +--------------- guix/build/python-build-system.scm | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'guix/build') diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 8f65852630..55d23e45e8 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -262,25 +262,11 @@ (define-public python-setuptools "0hl9sa5xr9bi2ifq51wy1bawsjv5nzvpbac7m9z1ciz778874csf")))) (build-system python-build-system) (arguments - `(#:tests? #f + `(#:tests? #f)) ;;FIXME: test_sdist_with_utf8_encoded_filename fails in ;; /tmp/nix-build-python2-setuptools-1.1.4.drv-0/setuptools-1.1.4/setuptools/tests/test_sdist.py" ;; line 354 ;; The tests pass with Python 2.7.5. - #:phases - (alist-replace - 'install - (lambda* (#:key outputs #:allow-other-keys #:rest args) - (let* ((install (assoc-ref %standard-phases 'install)) - (out (assoc-ref outputs "out")) - (python (assoc-ref %build-inputs "python")) - (python-version (string-take (string-take-right python 5) 3)) - (path (string-append out "/lib/python" python-version - "/site-packages/"))) - (mkdir-p path) - (setenv "PYTHONPATH" path) - (apply install args))) - %standard-phases))) (home-page "https://pypi.python.org/pypi/setuptools") (synopsis "Library designed to facilitate packaging Python projects") diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index f213a97f01..0bb8c4d49d 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -54,12 +54,27 @@ (define* (check #:key tests? test-target #:allow-other-keys) (call-setuppy test-target '()) #t)) -(define* (install #:key outputs (configure-flags '()) +(define (get-python-version python) + (string-take (string-take-right python 5) 3)) + +(define* (install #:key outputs inputs (configure-flags '()) #:allow-other-keys) "Install a given Python package." (let* ((out (assoc-ref outputs "out")) (params (append (list (string-append "--prefix=" out)) - configure-flags))) + configure-flags)) + (python-version (get-python-version (assoc-ref inputs "python"))) + (old-path (getenv "PYTHONPATH")) + (add-path (string-append out "/lib/python" python-version + "/site-packages/"))) + ;; create the module installation directory and add it to PYTHONPATH + ;; to make setuptools happy + (mkdir-p add-path) + (setenv "PYTHONPATH" + (string-append (if old-path + (string-append old-path ":") + "") + add-path)) (call-setuppy "install" params))) (define* (wrap #:key inputs outputs #:allow-other-keys) @@ -79,10 +94,10 @@ (define bindirs (let* ((out (assoc-ref outputs "out")) (python (assoc-ref inputs "python")) - (python-version (string-take (string-take-right python 5) 3)) (var `("PYTHONPATH" prefix ,(cons (string-append out "/lib/python" - python-version "/site-packages") + (get-python-version python) + "/site-packages") (search-path-as-string->list (or (getenv "PYTHONPATH") "")))))) (for-each (lambda (dir) -- cgit v1.2.3