From: Nikita Karetnikov <nikita@karetnikov.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: bug-guix@gnu.org
Subject: Re: 'python-build-system'
Date: Wed, 08 May 2013 05:52:47 +0400 [thread overview]
Message-ID: <87ppx2qlu8.fsf@karetnikov.org> (raw)
In-Reply-To: <871u9tlfzx.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 29 Apr 2013 13:42:58 +0200")
[-- Attachment #1.1: Type: text/plain, Size: 1164 bytes --]
> If you append (package-native-search-paths python) to the list of search
> paths, then PYTHONPATH will automagically be defined appropriately (see
> <http://lists.gnu.org/archive/html/bug-guix/2013-03/msg00158.html>.)
> If you don’t, then PYTHONPATH will be undefined, unless you explicitly
> define it in build/python-build-system.scm, which is not the recommended
> option.
> So just mimic the change made in the above commit for perl-build-system.
OK, I've added it. Should I remove the following part?
+ (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)))
Or is it a different issue? If both do the same thing, the
'package-native-search-paths' approach feels more verbose. Because one
should specify it in recipes. Am I mistaken?
Can I push both patches to 'master'?
[-- Attachment #1.2: 0001-Add-python-build-system.patch --]
[-- Type: text/x-diff, Size: 10493 bytes --]
From f81f98e05a7b3a08afbebd1e756dff37b76847f1 Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Wed, 8 May 2013 00:44:12 +0000
Subject: [PATCH] Add 'python-build-system'.
* guix/build-system/python.scm, guix/build/python-build-system.scm: New files.
* Makefile.am (MODULES): Add them.
---
Makefile.am | 2 +
guix/build-system/python.scm | 115 ++++++++++++++++++++++++++++++++++++
guix/build/python-build-system.scm | 89 ++++++++++++++++++++++++++++
3 files changed, 206 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 0f325c8..15cbde8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,6 +46,7 @@ MODULES = \
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 = \
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..f90d1a5
--- /dev/null
+++ b/guix/build-system/python.scm
@@ -0,0 +1,115 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(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 python-search-paths
+ (append (package-native-search-paths python)
+ (standard-search-paths)))
+
+ (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 python-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-system.scm
new file mode 100644
index 0000000..1df1746
--- /dev/null
+++ b/guix/build/python-build-system.scm
@@ -0,0 +1,89 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
+;;;
+;;; 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 <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 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=" out)
+ ,@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 during
+ ;; '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
--
1.7.5.4
[-- Attachment #1.3: 0001-gnu-Add-GNU-Bazaar.patch --]
[-- Type: text/x-diff, Size: 3312 bytes --]
From aed549f8c6971f6de8f048a8f2b90aa0ca2c7b0e Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov <nikita@karetnikov.org>
Date: Wed, 8 May 2013 00:50:05 +0000
Subject: [PATCH] gnu: Add GNU Bazaar.
* gnu/packages/bazaar.scm: New file.
* Makefile.am (MODULES): Add it.
---
Makefile.am | 1 +
gnu/packages/bazaar.scm | 54 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)
create mode 100644 gnu/packages/bazaar.scm
diff --git a/Makefile.am b/Makefile.am
index 15cbde8..e3b514c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,6 +72,7 @@ MODULES = \
gnu/packages/avahi.scm \
gnu/packages/base.scm \
gnu/packages/bash.scm \
+ gnu/packages/bazaar.scm \
gnu/packages/bdb.scm \
gnu/packages/bdw-gc.scm \
gnu/packages/bison.scm \
diff --git a/gnu/packages/bazaar.scm b/gnu/packages/bazaar.scm
new file mode 100644
index 0000000..b318bff
--- /dev/null
+++ b/gnu/packages/bazaar.scm
@@ -0,0 +1,54 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(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)
+ #:use-module ((gnu packages gettext)
+ #:renamer (symbol-prefix-proc 'guix:)))
+
+(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)
+ (inputs
+ ;; FIXME: 'tools/packaging/lp-upload-release' and 'tools/weavemerge.sh'
+ ;; require Zsh.
+ `(("gettext" ,guix:gettext)))
+ (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 both
+central version control and distributed version control. Developers can
+organize their workspace in whichever way they want. It is possible to work
+from a command line or use a GUI application.")
+ (license gpl2+)))
\ No newline at end of file
--
1.7.5.4
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
next prev parent reply other threads:[~2013-05-08 1:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-05 18:21 'python-build-system' Nikita Karetnikov
2013-04-07 10:34 ` 'python-build-system' Ludovic Courtès
2013-04-23 9:49 ` ERROR: missing interface for module (gnutls) (was: 'python-build-system') Nikita Karetnikov
2013-04-23 11:51 ` ERROR: missing interface for module (gnutls) Ludovic Courtès
2013-04-23 15:03 ` Nikita Karetnikov
2013-04-23 16:01 ` Ludovic Courtès
2013-04-27 15:14 ` 'python-build-system' Ludovic Courtès
2013-04-28 1:55 ` 'python-build-system' Nikita Karetnikov
2013-04-28 17:18 ` 'python-build-system' Nikita Karetnikov
2013-04-28 20:52 ` 'python-build-system' Ludovic Courtès
2013-04-29 3:50 ` 'python-build-system' Nikita Karetnikov
2013-04-29 11:42 ` 'python-build-system' Ludovic Courtès
2013-05-08 1:52 ` Nikita Karetnikov [this message]
2013-05-08 16:47 ` 'python-build-system' Ludovic Courtès
2013-05-08 23:22 ` 'python-build-system' Nikita Karetnikov
2013-05-09 20:29 ` 'python-build-system' Ludovic Courtès
2013-04-29 19:33 ` 'python-build-system' Ludovic Courtès
2013-04-30 15:04 ` 'python-build-system' Ludovic Courtès
2013-04-28 22:50 ` 'python-build-system' Cyril Roelandt
2013-04-29 11:50 ` 'python-build-system' Ludovic Courtès
2013-04-29 19:24 ` 'python-build-system' Cyril Roelandt
2013-04-30 13:47 ` 'python-build-system' Nikita Karetnikov
2013-05-06 21:07 ` 'python-build-system' 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=87ppx2qlu8.fsf@karetnikov.org \
--to=nikita@karetnikov.org \
--cc=bug-guix@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 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.