From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Karetnikov Subject: Re: 'python-build-system' Date: Sun, 28 Apr 2013 21:18:43 +0400 Message-ID: <877gjmr2to.fsf@karetnikov.org> References: <87sj34zvn1.fsf@karetnikov.org> <87ehdwkntv.fsf@gnu.org> <87sj2b8llf.fsf@karetnikov.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWVCa-0005NR-5U for bug-guix@gnu.org; Sun, 28 Apr 2013 13:15:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWVCW-0004XU-NG for bug-guix@gnu.org; Sun, 28 Apr 2013 13:15:52 -0400 In-Reply-To: <87sj2b8llf.fsf@karetnikov.org> (Nikita Karetnikov's message of "Sun, 28 Apr 2013 05:55:56 +0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: bug-guix@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= 'bazaar.scm' is for testing. The following warnings appear during the installation: GNU gettext msgfmt utility not found! patch-shebang: ./tools/packaging/lp-upload-release: warning: no binary for interpreter `zsh' found in $PATH patch-shebang: ./tools/weavemerge.sh: warning: no binary for interpreter `zsh' found in $PATH Can we replace 'zsh' with 'bash'? I guess there may be some compatibility problems. Should we package 'zsh' instead? I haven't checked, but it seems there are two tarballs: the first one contains sources and the second contains docs. Is there a way to specify both in a single recipe? Also, I should mention that I don't understand some parts of the build system. I'm not sure how to check them. Is there a Scheme level 'strace'-like tool? If not, I'll send more specific questions later. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-utils-Adjust-wrap-program.patch Content-Transfer-Encoding: quoted-printable From=20aa73cd5d8e5e48d24460c9d6bcebfc92b3311d4c Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Sun, 28 Apr 2013 16:08:23 +0000 Subject: [PATCH] utils: Adjust 'wrap-program'. * guix/build/utils.scm (wrap-program): Assume that 'prog' is an absolute filename. Adjust 'prog-real' and 'prog-tmp' accordingly. Also, change 'prog-tmp' to honor command line arguments. =2D-- guix/build/utils.scm | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 356dd46..fe6978b 100644 =2D-- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -680,8 +680,8 @@ contents: This is useful for scripts that expect particular programs to be in $PATH,= for programs that expect particular shared libraries to be in $LD_LIBRARY_PATH= , or modules in $GUILE_LOAD_PATH, etc." =2D (let ((prog-real (string-append "." prog "-real")) =2D (prog-tmp (string-append "." prog "-tmp"))) + (let ((prog-real (string-append (dirname prog) "/." (basename prog) "-re= al")) + (prog-tmp (string-append (dirname prog) "/." (basename prog) "-tm= p"))) (define (export-variable lst) ;; Return a string that exports an environment variable. (match lst @@ -709,11 +709,11 @@ modules in $GUILE_LOAD_PATH, etc." (with-output-to-file prog-tmp (lambda () (format #t =2D "#!~a~%~a~%exec ~a~%" + "#!~a~%~a~%exec ~a $@~%" (which "bash") (string-join (map export-variable vars) "\n") =2D (canonicalize-path prog-real)))) + prog-real))) =20 (chmod prog-tmp #o755) (rename-file prog-tmp prog))) =2D-=20 1.7.5.4 --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-Add-python-build-system.patch Content-Transfer-Encoding: quoted-printable From=20e217b27883223f4c6adc39c4ed3c1af6d1ddf4af Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Sun, 28 Apr 2013 12:55:27 +0000 Subject: [PATCH] Add 'python-build-system'. * guix/build-system/python.scm, guix/build/python-build-system.scm: New fil= es. * Makefile.am (MODULES): Add them. =2D-- Makefile.am | 2 + guix/build-system/python.scm | 111 ++++++++++++++++++++++++++++++++= ++++ guix/build/python-build-system.scm | 89 +++++++++++++++++++++++++++++ 3 files changed, 202 insertions(+), 0 deletions(-) create mode 100644 guix/build-system/python.scm create mode 100644 guix/build/python-build-system.scm diff --git a/Makefile.am b/Makefile.am index 847d850..7172a90 100644 =2D-- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,7 @@ MODULES =3D \ guix/build-system/cmake.scm \ guix/build-system/gnu.scm \ guix/build-system/perl.scm \ + guix/build-system/python.scm \ guix/build-system/trivial.scm \ guix/ftp-client.scm \ guix/web.scm \ @@ -56,6 +57,7 @@ MODULES =3D \ guix/build/cmake-build-system.scm \ guix/build/gnu-build-system.scm \ guix/build/perl-build-system.scm \ + guix/build/python-build-system.scm \ guix/build/utils.scm \ guix/build/union.scm \ guix/packages.scm \ diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm new file mode 100644 index 0000000..55d752a =2D-- /dev/null +++ b/guix/build-system/python.scm @@ -0,0 +1,111 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2013 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2013 Nikita Karetnikov +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build-system python) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (guix derivations) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) + #:use-module (ice-9 match) + #:export (python-build + python-build-system)) + +;; Commentary: +;; +;; Standard build procedure for Python packages using 'setup.py'. This is +;; implemented as an extension of 'gnu-build-system'. +;; +;; Code: + +(define* (python-build store name source inputs + #:key + (python (@ (gnu packages python) python)) + (python-version + (string-take (package-version + (@ (gnu packages python) python)) 3)) + (tests? #t) + (configure-flags ''()) + (phases '(@ (guix build python-build-system) + %standard-phases)) + (outputs '("out")) + (search-paths '()) + (system (%current-system)) + (guile #f) + (imported-modules '((guix build python-build-system) + (guix build gnu-build-system) + (guix build utils))) + (modules '((guix build python-build-system) + (guix build gnu-build-system) + (guix build utils)))) + "Build SOURCE using PYTHON, and with INPUTS. This assumes that SOURCE +provides a 'setup.py' file as its build system." + (define builder + `(begin + (use-modules ,@modules) + (python-build #:name ,name + #:source ,(if (and source (derivation-path? source)) + (derivation-path->output-path source) + source) + #:configure-flags ,configure-flags + #:system ,system + #:test-target "test" + #:tests? ,tests? + #:outputs %outputs + #:python-version ,python-version + #:search-paths ',(map search-path-specification->sexp + (append search-paths + (standard-search-paths)= )) + #:inputs %build-inputs))) + + (define guile-for-build + (match guile + ((? package?) + (package-derivation store guile system)) + ((and (? string?) (? derivation-path?)) + guile) + (#f ; the default + (let* ((distro (resolve-interface '(gnu packages base))) + (guile (module-ref distro 'guile-final))) + (package-derivation store guile system))))) + + (let ((python (package-derivation store python system))) + (build-expression->derivation store name system + builder + `(,@(if source + `(("source" ,source)) + '()) + ("python" ,python) + ,@inputs + + ;; Keep the standard inputs of + ;; 'gnu-build-system'. + ,@(standard-inputs system)) + + #:modules imported-modules + #:outputs outputs + #:guile-for-build guile-for-build))) + +(define python-build-system + (build-system (name 'python) + (description "The standard Python build system") + (build python-build))) + +;;; python.scm ends here \ No newline at end of file diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-s= ystem.scm new file mode 100644 index 0000000..1df1746 =2D-- /dev/null +++ b/guix/build/python-build-system.scm @@ -0,0 +1,89 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2013 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2013 Nikita Karetnikov +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build python-build-system) + #:use-module ((guix build gnu-build-system) + #:renamer (symbol-prefix-proc 'gnu:)) + #: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 + python-build)) + +;; Commentary: +;; +;; Builder-side code of the standard Python package build procedure. +;; +;; 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=3D" o= ut) + ,@configure-flags))) + (format #t "running 'python' with arguments ~s~%" args) + (zero? (apply system* "python" args))) + (error "no setup.py found")))) + +(define* (wrap #:key outputs python-version #:allow-other-keys) + (define (list-of-files dir) + (map (cut string-append dir "/" <>) + (or (scandir dir (lambda (f) + (let ((s (stat (string-append dir "/" f)))) + (eq? 'regular (stat:type s))))) + '()))) + + (define bindirs + (append-map (match-lambda + ((_ . dir) + (list (string-append dir "/bin") + (string-append dir "/sbin")))) + outputs)) + + (let* ((out (assoc-ref outputs "out")) + (var `("PYTHONPATH" prefix + (,(string-append out "/lib/python" + python-version "/site-packages"))))) + (for-each (lambda (dir) + (let ((files (list-of-files dir))) + (for-each (cut wrap-program <> var) + files))) + bindirs))) + +(define %standard-phases + ;; 'configure' and 'build' phases are not needed. Everything is done du= ring + ;; 'install'. + (alist-cons-after + 'install 'wrap + wrap + (alist-replace 'install install + (alist-delete 'configure + (alist-delete 'build + gnu:%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)) + +;;; python-build-system.scm ends here \ No newline at end of file =2D-=20 1.7.5.4 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=bazaar.scm Content-Transfer-Encoding: quoted-printable ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2013 Nikita Karetnikov ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages bazaar) #:use-module ((guix licenses) #:select (gpl2+)) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system python) #:use-module (guix build utils)) (define-public bazaar (package (name "bazaar") (version "2.5.1") (source (origin (method url-fetch) (uri (string-append "https://launchpad.net/bzr/2.5/" version "/+download/bzr-" version ".tar.gz")) (sha256 (base32 "10krjbzia2avn09p0cdlbx2wya0r5v11w5ymvyl72af5dkx4cwwn")))) (build-system python-build-system) (arguments `(#:tests? #f)) (home-page "https://gnu.org/software/bazaar") (synopsis "Distributed and central version control system") (description "GNU Bazaar is a distributed version control system, which supports bo= th central version control and distributed version control. Developers can organize their workspace in whichever way they want. It is possible to work From=20a command line or use a GUI application.") (license gpl2+))) --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJRfVn4AAoJEM+IQzI9IQ38qxQQAJfWY9ULGIcGiCdsYl+8Iqro DYT3FdtCO/Tcm0BttXO1Zkn+7PRDPN5ILcGD1DqhCvKCfaVbsyy8fFsDIMZ0Fqbs CSIJIXSYSNsQ8G2AKrqCBWwySYmq61ugKzR+p8S+hSE82vrnDywxt5VH1EG5jJUm mw3f+w8ycaizLvNtS0N+hFUfNCKtttHiKB2MB5MKuFwH/fbcU9drnqcYnPMXEopS 9ZpMmrqtI59TSqMTXK8dEfC9VtgGUWtOMHKeHR5pa5VAR2Q96KvWWJuQNAE12j0G pl6Q6N8Kj0TDWF0js7ZSrKuD+de4Pkp1uP0FIrbjblpodC3SMy7p20tR5uv/NETU P0H5MVR3rK/qqLRcxMYPf7h6GiRMcXtMKlFvXL0bLE2jkXDjukk+L3lZIIsEqmMg kveGZgJjln2qsS7rlczDyFHlnXijaevVgaWjif1vIFUe5FGkV89SQABm+5Zt4ho9 1YuLr03JVpSWnj3iPFrdEBtu8GMPFBnEvuv3TRerU07BasuglM2if8L313nBALD5 kq40XaqPeRsdxQxOG30mxgEsgYuVRlHxEPLxbXRq5KHYMhOEcPgCW1p/brkQaI0G oL97ID91C8AlJpecUCLui2oAz8HoaoQpZjovcEVDp7gfhN43KzuHc+3kHGTdEaim Uw23+kMbNwn+HE5BVCxk =65/H -----END PGP SIGNATURE----- --==-=-=--