aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Enge <andreas@enge.fr>2013-09-14 10:45:01 +0200
committerAndreas Enge <andreas@enge.fr>2013-09-14 10:45:01 +0200
commitaae4ead8142d4fd7c674a1e6e302f40469f878c6 (patch)
tree022987d73c705ca882e50c8a63b578c658a72de6
parent29479de5659ba912b486c74078403bbb9a4df104 (diff)
parent2875caf5b52340ea16965b1d8f76342cc07bf8b5 (diff)
downloadguix-aae4ead8142d4fd7c674a1e6e302f40469f878c6.tar
guix-aae4ead8142d4fd7c674a1e6e302f40469f878c6.tar.gz
Merge branch 'python'
-rw-r--r--gnu/packages/cryptsetup.scm2
-rw-r--r--gnu/packages/gdb.scm2
-rw-r--r--gnu/packages/ghostscript.scm2
-rw-r--r--gnu/packages/glib.scm2
-rw-r--r--gnu/packages/gnupg.scm2
-rw-r--r--gnu/packages/gtk.scm4
-rw-r--r--gnu/packages/libevent.scm2
-rw-r--r--gnu/packages/netpbm.scm2
-rw-r--r--gnu/packages/oggvorbis.scm2
-rw-r--r--gnu/packages/python.scm195
-rw-r--r--gnu/packages/qemu.scm2
-rw-r--r--gnu/packages/samba.scm2
-rw-r--r--gnu/packages/texlive.scm4
-rw-r--r--gnu/packages/version-control.scm8
-rw-r--r--gnu/packages/xml.scm4
-rw-r--r--gnu/packages/xorg.scm8
-rw-r--r--gnu/packages/yasm.scm2
-rw-r--r--gnu/packages/zip.scm3
-rw-r--r--guix/build-system/python.scm62
-rw-r--r--guix/build/python-build-system.scm71
20 files changed, 314 insertions, 67 deletions
diff --git a/gnu/packages/cryptsetup.scm b/gnu/packages/cryptsetup.scm
index c746e28721..8645e9e04a 100644
--- a/gnu/packages/cryptsetup.scm
+++ b/gnu/packages/cryptsetup.scm
@@ -45,7 +45,7 @@
`(("libgcrypt" ,libgcrypt)
("lvm2" ,lvm2)
("popt" ,popt)
- ("python" ,python)
+ ("python" ,python-wrapper)
("util-linux" ,util-linux)))
(synopsis "hard disk encryption tool")
(description
diff --git a/gnu/packages/gdb.scm b/gnu/packages/gdb.scm
index 4cf6b90cc3..5190283895 100644
--- a/gnu/packages/gdb.scm
+++ b/gnu/packages/gdb.scm
@@ -53,7 +53,7 @@
("gmp" ,gmp)
("readline" ,readline)
("ncurses" ,ncurses)
- ("python" ,python)
+ ("python" ,python-wrapper)
("texinfo" ,texinfo)
("dejagnu" ,dejagnu)))
(home-page "http://www.gnu.org/software/gdb/")
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index dd6c576cdf..7df1f6c17e 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -136,7 +136,7 @@ printing, and psresize, for adjusting page sizes.")
("libtiff" ,libtiff)
("perl" ,perl)
("pkg-config" ,pkg-config) ; needed to find libtiff
- ("python" ,python)
+ ("python" ,python-wrapper)
("tcl" ,tcl)
("zlib" ,zlib)))
(arguments
diff --git a/gnu/packages/glib.scm b/gnu/packages/glib.scm
index dd4c036e4b..da15d404dd 100644
--- a/gnu/packages/glib.scm
+++ b/gnu/packages/glib.scm
@@ -104,7 +104,7 @@ shared NFS home directories.")
("gettext" ,guix:gettext)
("libffi" ,libffi)
("pkg-config" ,pkg-config)
- ("python" ,python)
+ ("python" ,python-wrapper)
("zlib" ,zlib)
("perl" ,perl) ; needed by GIO tests
("dbus" ,dbus) ; for GDBus tests
diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm
index 604ebc2941..7c0f50900a 100644
--- a/gnu/packages/gnupg.scm
+++ b/gnu/packages/gnupg.scm
@@ -191,7 +191,7 @@ S/MIME.")
"1g1jly3wl4ks6h8ydkygyl2c4i7v3z91rg42005m6vm70y1d8b3d"))))
(build-system gnu-build-system)
(inputs `(("perl" ,perl)
- ("python" ,python)
+ ("python" ,python-wrapper)
("gpg" ,gnupg)))
(arguments
`(#:tests? #f
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 742cbf172e..e72f7c5acc 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -83,7 +83,7 @@ tools have full access to view and control running applications.")
("libspectre" ,libspectre)
("pkg-config" ,pkg-config)
("poppler" ,poppler)
- ("python" ,python)
+ ("python" ,python-wrapper)
("xextproto" ,xextproto)
("zlib" ,zlib)))
(arguments
@@ -123,7 +123,7 @@ affine transformation (scale, rotation, shear, etc.)")
`(("cairo" ,cairo)
("icu4c" ,icu4c)
("pkg-config" ,pkg-config)
- ("python" ,python)))
+ ("python" ,python-wrapper)))
(synopsis "opentype text shaping engine")
(description
"HarfBuzz is an OpenType text shaping engine.")
diff --git a/gnu/packages/libevent.scm b/gnu/packages/libevent.scm
index ccca427fc4..8f2d5dad46 100644
--- a/gnu/packages/libevent.scm
+++ b/gnu/packages/libevent.scm
@@ -44,7 +44,7 @@
;; Dependencies used for the tests and for `event_rpcgen.py'.
("which" ,which)
- ("python" ,python)))
+ ("python" ,python-wrapper)))
(arguments
'(#:patches (list (assoc-ref %build-inputs "patch/dns-tests"))))
(home-page "http://libevent.org/")
diff --git a/gnu/packages/netpbm.scm b/gnu/packages/netpbm.scm
index d2213b8f0d..c8d3603701 100644
--- a/gnu/packages/netpbm.scm
+++ b/gnu/packages/netpbm.scm
@@ -57,7 +57,7 @@
("libxml2" ,libxml2)
("perl" ,perl)
("pkg-config" ,pkg-config)
- ("python" ,python)
+ ("python" ,python-wrapper)
("zlib" ,zlib)))
(arguments
`(#:phases
diff --git a/gnu/packages/oggvorbis.scm b/gnu/packages/oggvorbis.scm
index 2aa606ca22..589828be0a 100644
--- a/gnu/packages/oggvorbis.scm
+++ b/gnu/packages/oggvorbis.scm
@@ -191,7 +191,7 @@ meaning that audio is compressed in FLAC without any loss in quality.")
("libogg" ,libogg)
("libpng" ,libpng)
("pkg-config" ,pkg-config)
- ("python" ,python)
+ ("python" ,python-wrapper)
("zlib" ,zlib)))
(synopsis "kate, a karaoke and text codec for embedding in ogg")
(description
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 493068adde..be33bf6570 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -19,19 +19,24 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages python)
- #:use-module ((guix licenses) #:select (bsd-3 psfl x11))
+ #:use-module ((guix licenses) #:select (bsd-3 bsd-style psfl x11))
+ #:use-module ((guix licenses) #:select (zlib)
+ #:renamer (symbol-prefix-proc 'license))
#:use-module (gnu packages)
#:use-module (gnu packages compression)
#:use-module (gnu packages gdbm)
#:use-module (gnu packages readline)
#:use-module (gnu packages openssl)
#:use-module (gnu packages patchelf)
+ #:use-module (gnu packages sqlite)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
- #:use-module (guix build-system python))
+ #:use-module (guix build-system python)
+ #:use-module (guix build-system trivial))
-(define-public python
+(define-public python-2
(package
(name "python")
(version "2.7.5")
@@ -151,8 +156,8 @@ packages; exception-based error handling; and very high level dynamic
data types.")
(license psfl)))
-(define-public python-3
- (package (inherit python)
+(define-public python
+ (package (inherit python-2)
(version "3.3.2")
(source
(origin
@@ -167,9 +172,34 @@ data types.")
(variable "PYTHONPATH")
(directories '("lib/python3.3/site-packages")))))))
-(define-public pytz
+(define-public python-wrapper
+ (package (inherit python)
+ (name "python-wrapper")
+ (source #f)
+ (build-system trivial-build-system)
+ (inputs `(("python" ,python)))
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
+ (python (string-append (assoc-ref %build-inputs "python") "/bin/")))
+ (mkdir-p bin)
+ (for-each
+ (lambda (old new)
+ (symlink (string-append python old)
+ (string-append bin "/" new)))
+ `("python3", "pydoc3", "idle3")
+ `("python", "pydoc", "idle"))))))
+ (description (string-append (package-description python)
+ "\n\nThis wrapper package provides symbolic links to the python binaries
+ without version suffix."))))
+
+
+(define-public python-pytz
(package
- (name "pytz")
+ (name "python-pytz")
(version "2013b")
(source
(origin
@@ -180,6 +210,7 @@ data types.")
(base32
"19giwgfcrg0nr1gdv49qnmf2jb2ilkcfc7qyqvfpz4dp0p64ksv5"))))
(build-system python-build-system)
+ (arguments `(#:tests? #f)) ; no test target
(home-page "https://launchpad.net/pytz")
(synopsis "The Python timezone library.")
(description
@@ -187,22 +218,28 @@ data types.")
using Python 2.4 or higher and provides access to the Olson timezone database.")
(license x11)))
-(define-public babel
+(define-public python2-pytz
+ (package-with-python2 python-pytz))
+
+
+(define-public python-babel
(package
- (name "babel")
- (version "0.9.6")
+ (name "python-babel")
+ (version "1.3")
(source
(origin
(method url-fetch)
- (uri (string-append "http://ftp.edgewall.com/pub/babel/Babel-"
+ (uri (string-append "https://pypi.python.org/packages/source/B/Babel/Babel-"
version ".tar.gz"))
(sha256
(base32
- "03vmr54jq5vf3qw6kpdv7cdk7x7i2jhzyf1mawv2gk8zrxg0hfja"))))
+ "0bnin777lc53nxd1hp3apq410jj5wx92n08h7h4izpl4f4sx00lz"))))
(build-system python-build-system)
(inputs
- `(("pytz" ,pytz)))
- (home-page "http://babel.edgewall.org/")
+ `(("python-pytz" ,python-pytz)
+ ("python-setuptools" ,python-setuptools)))
+ (arguments `(#:tests? #f)) ; no test target
+ (home-page "http://babel.pocoo.org/")
(synopsis
"Tools for internationalizing Python applications")
(description
@@ -212,3 +249,133 @@ using Python 2.4 or higher and provides access to the Olson timezone database.")
access to various locale display names, localized number and date formatting,
etc. ")
(license bsd-3)))
+
+(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: 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.
+ (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)))
+
+(define-public python2-setuptools
+ (package-with-python2 python-setuptools))
+
+
+(define-public python-dateutil
+ (package
+ (name "python-dateutil")
+ (version "1.5") ; last version for python < 3
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://labix.org/download/python-dateutil/python-dateutil-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "0fqfglhy5khbvsipr3x7m6bcaqljh8xl5cw33vbfxy7qhmywm2n0"))))
+ (build-system python-build-system)
+ (inputs
+ `(("python-setuptools" ,python-setuptools)))
+ (home-page "http://labix.org/python-dateutil")
+ (synopsis
+ "Extensions to the standard datetime module, available in Python 2.3+")
+ (description
+ "The dateutil module provides powerful extensions to the standard
+datetime module, available in Python 2.3+.")
+ (license psfl)))
+
+(define-public python2-dateutil
+ (package-with-python2 python-dateutil))
+
+
+(define-public python2-pysqlite
+ (package
+ (name "python2-pysqlite")
+ (version "2.6.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://pysqlite.googlecode.com/files/pysqlite-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "0nsqqfp072rgqbls100rdvbzkjkin7li3kprhfxlfqvzf608hlqd"))))
+ (build-system python-build-system)
+ (inputs
+ `(("sqlite" ,sqlite)))
+ (arguments
+ `(#:python ,python-2 ; incompatible with Python 3
+ #:tests? #f)) ; no test target
+ (home-page "http://labix.org/python-dateutil")
+ (synopsis
+ "SQLite bindings for Python.")
+ (description
+ "Pysqlite provides SQLite bindings for Python that comply to the
+Database API 2.0T.")
+ (license zlib)))
+
+
+(define-public python2-mechanize
+ (package
+ (name "python2-mechanize")
+ (version "0.2.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://pypi.python.org/packages/source/m/mechanize/mechanize-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "0rj7r166i1dyrq0ihm5rijfmvhs8a04im28lv05c0c3v206v4rrf"))))
+ (build-system python-build-system)
+ (inputs
+ `(("python2-setuptools" ,python2-setuptools)))
+ (arguments
+ `(#:python ,python-2 ; apparently incompatible with Python 3
+ #:tests? #f))
+ ;; test fails with message
+ ;; AttributeError: 'module' object has no attribute 'test_pullparser'
+ ;; (python-3.3.2) or
+ ;; AttributeError: 'module' object has no attribute 'test_urllib2_localnet'
+ ;; (python-2.7.5).
+ ;; The source code is from March 2011 and probably not up-to-date
+ ;; with respect to python unit tests.
+ (home-page "http://wwwsearch.sourceforge.net/mechanize/")
+ (synopsis
+ "Stateful programmatic web browsing in Python")
+ (description
+ "Mechanize implements stateful programmatic web browsing in Python,
+after Andy Lester’s Perl module WWW::Mechanize.")
+ (license (bsd-style "file://COPYING"
+ "See COPYING in the distribution."))))
+
diff --git a/gnu/packages/qemu.scm b/gnu/packages/qemu.scm
index 9c9355c4d6..6330fabcf9 100644
--- a/gnu/packages/qemu.scm
+++ b/gnu/packages/qemu.scm
@@ -94,7 +94,7 @@
`(;; ("mesa" ,mesa)
;; ("libaio" ,libaio)
("glib" ,glib)
- ("python" ,python)
+ ("python" ,python-2) ; incompatible with Python 3 according to error message
("ncurses" ,ncurses)
("libpng" ,libpng)
("libjpeg" ,libjpeg-8)
diff --git a/gnu/packages/samba.scm b/gnu/packages/samba.scm
index b016442908..e0199bce90 100644
--- a/gnu/packages/samba.scm
+++ b/gnu/packages/samba.scm
@@ -150,7 +150,7 @@ anywhere.")
("patchelf" ,patchelf))) ; for (guix build rpath)
(native-inputs ; for the test suite
`(("perl" ,perl)
- ("python" ,python)))
+ ("python" ,python-wrapper)))
(home-page "http://www.samba.org/")
(synopsis
"The standard Windows interoperability suite of programs for GNU and Unix")
diff --git a/gnu/packages/texlive.scm b/gnu/packages/texlive.scm
index a0d57444e3..7c6f82b9c9 100644
--- a/gnu/packages/texlive.scm
+++ b/gnu/packages/texlive.scm
@@ -81,7 +81,7 @@
("pkg-config" ,pkg-config)
;; FIXME: Add interpreters fontforge and ruby,
;; once they are available.
- ("python" ,python)
+ ("python" ,python-2) ; incompatible with Python 3 (print syntax)
("tcsh" ,tcsh)
("teckit" ,teckit)
("t1lib" ,t1lib)
@@ -202,7 +202,7 @@ world.")
(build-system gnu-build-system)
(arguments '(#:tests? #f)) ; no `check' target
(inputs `(("texinfo" ,texinfo)
- ("python" ,python)
+ ("python" ,python-2) ; incompatible with Python 3 (print syntax)
("which" ,which)))
(home-page "https://launchpad.net/rubber")
(synopsis "Rubber, a wrapper for LaTeX and friends")
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 14404f0bfe..42b5d5fe99 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -58,7 +58,9 @@
;; require Zsh.
`(("gettext" ,guix:gettext)))
(arguments
- `(#:tests? #f)) ; no test target
+ `(#:tests? #f ; no test target
+ #:python ,python-2)) ; Python 3 apparently not yet supported, see
+ ; https://answers.launchpad.net/bzr/+question/229048
(home-page "https://gnu.org/software/bazaar")
(synopsis "Decentralized revision control system")
(description
@@ -86,7 +88,7 @@ from a command line or use a GUI application.")
("gettext" ,guix:gettext)
("openssl" ,openssl)
("perl" ,perl)
- ("python" ,python) ; CAVEAT: incompatible with python-3 according to INSTALL
+ ("python" ,python-2) ; CAVEAT: incompatible with python-3 according to INSTALL
("zlib" ,zlib)))
(arguments
`(#:make-flags `("V=1") ; more verbose compilation
@@ -126,7 +128,7 @@ everything from small to very large projects with speed and efficiency.")
`(("apr" ,apr)
("apr-util" ,apr-util)
("perl" ,perl)
- ("python" ,python)
+ ("python" ,python-2) ; incompatible with Python 3 (print syntax)
("sqlite" ,sqlite)
("zlib" ,zlib)))
(home-page "http://subversion.apache.org/")
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index 2f9d64b81a..28c99b1f8c 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -66,7 +66,7 @@ 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-2) ; incompatible with Python 3 (print syntax)
("zlib" ,zlib)))
(arguments
`(#:phases
@@ -102,7 +102,7 @@ things the parser might find in the XML document (like start tags).")
(synopsis "libxslt, a C library for applying XSLT stylesheets to XML documents")
(inputs `(("libgcrypt" ,libgcrypt)
("libxml2" ,libxml2)
- ("python" ,python)
+ ("python" ,python-wrapper)
("zlib" ,zlib)))
(description
"Libxslt is an XSLT C library developed for the GNOME project. It is
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 98f104b0b6..9a0e3e274b 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -1857,7 +1857,7 @@ tracking.")
"0ds4qg6slidrzyz6q9ckq0a19hn6blzpnvciy4brh741gn49jpdd"))))
(build-system gnu-build-system)
(inputs
- `(("pkg-config" ,pkg-config) ("python" ,python)))
+ `(("pkg-config" ,pkg-config) ("python" ,python-wrapper)))
(home-page "http://www.x.org/wiki/")
(synopsis "xorg implementation of the X Window System")
(description "X.org provides an implementation of the X Window System")
@@ -4169,7 +4169,7 @@ tracking.")
("libxml2" ,libxml2)
("makedepend" ,makedepend)
("pkg-config" ,pkg-config)
- ("python" ,python)))
+ ("python" ,python-2))) ; incompatible with Python 3 (print syntax)
(arguments
`(#:configure-flags
`("--with-gallium-drivers=r600,svga,swrast") ; drop r300 from the default list as it requires llvm
@@ -4215,7 +4215,7 @@ emulation to complete hardware acceleration for modern GPUs.")
`(("xcb-proto" ,xcb-proto)
("libxslt" ,libxslt)
("pkg-config" ,pkg-config)
- ("python" ,python)))
+ ("python" ,python-wrapper)))
(home-page "http://www.x.org/wiki/")
(synopsis "xorg implementation of the X Window System")
(description "X.org provides an implementation of the X Window System")
@@ -4270,7 +4270,7 @@ emulation to complete hardware acceleration for modern GPUs.")
("mesa" ,mesa)
("openssl" ,openssl)
("pkg-config" ,pkg-config)
- ("python" ,python)
+ ("python" ,python-wrapper)
("recordproto" ,recordproto)
("resourceproto" ,resourceproto)
("scrnsaverproto" ,scrnsaverproto)
diff --git a/gnu/packages/yasm.scm b/gnu/packages/yasm.scm
index 51cd3ed0a5..a990d08174 100644
--- a/gnu/packages/yasm.scm
+++ b/gnu/packages/yasm.scm
@@ -40,7 +40,7 @@
"0cfg7ji3ia2in628w42wrfvw2ixmmm4rghwmv2k202mraysgm3vn"))))
(build-system gnu-build-system)
(inputs
- `(("python" ,python)
+ `(("python" ,python-wrapper)
("xmlto" ,xmlto)))
(home-page "http://yasm.tortall.net/")
(synopsis "Rewrite of the NASM assembler")
diff --git a/gnu/packages/zip.scm b/gnu/packages/zip.scm
index 934acdc316..f505d053c6 100644
--- a/gnu/packages/zip.scm
+++ b/gnu/packages/zip.scm
@@ -120,7 +120,8 @@ UnZip recreates the stored directory structure by default.")
(build-system gnu-build-system)
(inputs `(("perl" ,perl) ; for the documentation
("pkg-config" ,pkg-config)
- ("python" ,python) ; for the documentation
+ ("python" ,python-2) ; for the documentation; Python 3 not supported,
+ ; http://forums.gentoo.org/viewtopic-t-863161-start-0.html
("zip" ,zip) ; to create test files
("zlib" ,zlib)))
(arguments
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index b60adb182f..03e587ba01 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;;
;;; This file is part of GNU Guix.
@@ -25,7 +26,9 @@
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
#:use-module (ice-9 match)
- #:export (python-build
+ #:use-module (srfi srfi-26)
+ #:export (package-with-python2
+ python-build
python-build-system))
;; Commentary:
@@ -39,13 +42,60 @@
"Return the default Python package."
;; Lazily resolve the binding to avoid a circular dependency.
(let ((python (resolve-interface '(gnu packages python))))
- (module-ref python 'python)))
+ (module-ref python 'python-wrapper)))
+
+(define (default-python2)
+ "Return the default Python 2 package."
+ (let ((python (resolve-interface '(gnu packages python))))
+ (module-ref python 'python-2)))
+
+(define (package-with-explicit-python p python old-prefix new-prefix)
+ "Create a package with the same fields as P, which is assumed to use
+PYTHON-BUILD-SYSTEM, such that it is compiled with PYTHON instead. The
+inputs are changed recursively accordingly. If the name of P starts with
+OLD-PREFIX, this is replaced by NEW-PREFIX; otherwise, NEW-PREFIX is
+prepended to the name."
+ (let* ((build-system (package-build-system p))
+ (rewrite-if-package
+ (lambda (content)
+ ;; CONTENT may be a string (e.g., for patches), in which case it
+ ;; is returned, or a package, which is rewritten with the new
+ ;; PYTHON and NEW-PREFIX.
+ (if (package? content)
+ (package-with-explicit-python content python
+ old-prefix new-prefix)
+ content)))
+ (rewrite
+ (match-lambda
+ ((name content . rest)
+ (append (list name (rewrite-if-package content)) rest)))))
+ (package (inherit p)
+ (name
+ (let ((name (package-name p)))
+ (if (eq? build-system python-build-system)
+ (string-append new-prefix
+ (if (string-prefix? old-prefix name)
+ (substring name (string-length old-prefix))
+ name))
+ name)))
+ (arguments
+ (let ((arguments (package-arguments p)))
+ (if (eq? build-system python-build-system)
+ (if (member #:python arguments)
+ (substitute-keyword-arguments arguments ((#:python p) python))
+ (append arguments `(#:python ,python)))
+ arguments)))
+ (inputs
+ (map rewrite (package-inputs p)))
+ (native-inputs
+ (map rewrite (package-native-inputs p))))))
+
+(define package-with-python2
+ (cut package-with-explicit-python <> (default-python2) "python-" "python2-"))
(define* (python-build store name source inputs
#:key
(python (default-python))
- (python-version
- (string-take (package-version (default-python)) 3))
(tests? #t)
(configure-flags ''())
(phases '(@ (guix build python-build-system)
@@ -58,10 +108,10 @@
(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)))
@@ -77,8 +127,8 @@ provides a 'setup.py' file as its build system."
#:system ,system
#:test-target "test"
#:tests? ,tests?
+ #:phases ,phases
#:outputs %outputs
- #:python-version ,python-version
#:search-paths ',(map search-path-specification->sexp
(append python-search-paths
search-paths))
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 84299798b0..0bb8c4d49d 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 <ludo@gnu.org>
+;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;;
;;; This file is part of GNU Guix.
@@ -34,26 +35,49 @@
;;
;; 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 #:allow-other-keys)
- "Run the test suite of a given Python package."
+(define (call-setuppy command params)
(if (file-exists? "setup.py")
- (let ((args `("setup.py" "check")))
- (format #t "running 'python' with arguments ~s~%" args)
- (zero? (apply system* "python" args)))
+ (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* (wrap #:key outputs python-version #:allow-other-keys)
+(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?
+ (call-setuppy test-target '())
+ #t))
+
+(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))
+ (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)
(define (list-of-files dir)
(map (cut string-append dir "/" <>)
(or (scandir dir (lambda (f)
@@ -69,9 +93,11 @@
outputs))
(let* ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python"))
(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)
@@ -87,11 +113,12 @@
'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)