gnu: python: Revert 77c7f8f4 and make Python 3 the default.
[jackhill/guix/guix.git] / gnu / packages / python.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages python)
22 #:use-module ((guix licenses) #:select (bsd-3 psfl x11))
23 #:use-module (gnu packages)
24 #:use-module (gnu packages compression)
25 #:use-module (gnu packages gdbm)
26 #:use-module (gnu packages readline)
27 #:use-module (gnu packages openssl)
28 #:use-module (gnu packages patchelf)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system python))
33
34 (define-public python-2
35 (package
36 (name "python")
37 (version "2.7.5")
38 (source
39 (origin
40 (method url-fetch)
41 (uri (string-append "http://www.python.org/ftp/python/"
42 version "/Python-" version ".tar.xz"))
43 (sha256
44 (base32
45 "1c8xan2dlsqfq8q82r3mhl72v3knq3qyn71fjq89xikx2smlqg7k"))))
46 (build-system gnu-build-system)
47 (arguments
48 `(#:tests? #f
49 ;; 258 tests OK.
50 ;; 103 tests failed:
51 ;; test_bz2 test_distutils test_file test_file2k test_popen2
52 ;; test_shutil test_signal test_site test_slice test_smtplib
53 ;; test_smtpnet test_socket test_socketserver test_softspace
54 ;; test_sort test_sqlite test_ssl test_startfile test_str
55 ;; test_strftime test_string test_stringprep test_strop test_strptime
56 ;; test_strtod test_struct test_structmembers test_structseq
57 ;; test_subprocess test_sunaudiodev test_sundry test_symtable
58 ;; test_syntax test_sys test_sys_setprofile test_sys_settrace
59 ;; test_sysconfig test_tarfile test_tcl test_telnetlib test_tempfile
60 ;; test_textwrap test_thread test_threaded_import
61 ;; test_threadedtempfile test_threading test_threading_local
62 ;; test_threadsignals test_time test_timeout test_tk test_tokenize
63 ;; test_tools test_trace test_traceback test_transformer
64 ;; test_ttk_guionly test_ttk_textonly test_tuple test_typechecks
65 ;; test_ucn test_unary test_undocumented_details test_unicode
66 ;; test_unicode_file test_unicodedata test_univnewlines
67 ;; test_univnewlines2k test_unpack test_urllib test_urllib2
68 ;; test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse
69 ;; test_userdict test_userlist test_userstring test_uu test_uuid
70 ;; test_wait3 test_wait4 test_warnings test_wave test_weakref
71 ;; test_weakset test_whichdb test_winreg test_winsound test_with
72 ;; test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c
73 ;; test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile
74 ;; test_zipfile64 test_zipimport test_zipimport_support test_zlib
75 ;; 31 tests skipped:
76 ;; test_aepack test_al test_applesingle test_ascii_formatd test_bsddb
77 ;; test_bsddb185 test_bsddb3 test_cd test_cl test_codecmaps_cn
78 ;; test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
79 ;; test_codecmaps_tw test_ctypes test_curses test_dl test_gdb test_gl
80 ;; test_imageop test_imgfile test_ioctl test_kqueue
81 ;; test_linuxaudiodev test_macos test_macostools test_msilib
82 ;; test_multiprocessing test_ossaudiodev test_pep277
83 ;; test_scriptpackages
84 ;; 7 skips unexpected on linux2:
85 ;; test_ascii_formatd test_bsddb test_bsddb3 test_ctypes test_gdb
86 ;; test_ioctl test_multiprocessing
87 ;; One of the typical errors:
88 ;; test_unicode
89 ;; test test_unicode crashed -- <type 'exceptions.OSError'>: [Errno 2] No such file or directory
90 #:test-target "test"
91 #:configure-flags
92 (let ((bz2 (assoc-ref %build-inputs "bzip2"))
93 (gdbm (assoc-ref %build-inputs "gdbm"))
94 (openssl (assoc-ref %build-inputs "openssl"))
95 (readline (assoc-ref %build-inputs "readline"))
96 (zlib (assoc-ref %build-inputs "zlib")))
97 (list "--enable-shared" ; allow embedding
98 (string-append "CPPFLAGS="
99 "-I" bz2 "/include "
100 "-I" gdbm "/include "
101 "-I" openssl "/include "
102 "-I" readline "/include "
103 "-I" zlib "/include")
104 (string-append "LDFLAGS="
105 "-L" bz2 "/lib "
106 "-L" gdbm "/lib "
107 "-L" openssl "/lib "
108 "-L" readline "/lib "
109 "-L" zlib "/lib")))
110
111 #:modules ((guix build gnu-build-system)
112 (guix build utils)
113 (guix build rpath)
114 (srfi srfi-26))
115 #:imported-modules ((guix build gnu-build-system)
116 (guix build utils)
117 (guix build rpath))
118
119 #:phases
120 (alist-cons-after
121 'strip 'add-lib-to-runpath
122 (lambda* (#:key outputs #:allow-other-keys)
123 (let* ((out (assoc-ref outputs "out"))
124 (lib (string-append out "/lib")))
125 ;; Add LIB to the RUNPATH of all the executables.
126 (with-directory-excursion out
127 (for-each (cut augment-rpath <> lib)
128 (find-files "bin" ".*")))))
129 %standard-phases)))
130 (inputs
131 `(("bzip2" ,bzip2)
132 ("gdbm" ,gdbm)
133 ("openssl" ,openssl)
134 ("readline" ,readline)
135 ("zlib" ,zlib)
136 ("patchelf" ,patchelf))) ; for (guix build rpath)
137 (native-search-paths
138 (list (search-path-specification
139 (variable "PYTHONPATH")
140 (directories '("lib/python2.7/site-packages")))))
141 (home-page "http://python.org")
142 (synopsis
143 "Python, a high-level dynamically-typed programming language")
144 (description
145 "Python is a remarkably powerful dynamic programming language that
146 is used in a wide variety of application domains. Some of its key
147 distinguishing features include: clear, readable syntax; strong
148 introspection capabilities; intuitive object orientation; natural
149 expression of procedural code; full modularity, supporting hierarchical
150 packages; exception-based error handling; and very high level dynamic
151 data types.")
152 (license psfl)))
153
154 (define-public python
155 (package (inherit python-2)
156 (version "3.3.2")
157 (source
158 (origin
159 (method url-fetch)
160 (uri (string-append "http://www.python.org/ftp/python/"
161 version "/Python-" version ".tar.xz"))
162 (sha256
163 (base32
164 "0hsbwqjnhr85a2w252c8d3yj8d9i5sy8s6a6cfk6zqqhp3234nvl"))))
165 (native-search-paths
166 (list (search-path-specification
167 (variable "PYTHONPATH")
168 (directories '("lib/python3.3/site-packages")))))))
169
170 (define-public pytz
171 (package
172 (name "pytz")
173 (version "2013b")
174 (source
175 (origin
176 (method url-fetch)
177 (uri (string-append "https://launchpad.net/pytz/main/" version
178 "/+download/pytz-" version ".tar.bz2"))
179 (sha256
180 (base32
181 "19giwgfcrg0nr1gdv49qnmf2jb2ilkcfc7qyqvfpz4dp0p64ksv5"))))
182 (build-system python-build-system)
183 (home-page "https://launchpad.net/pytz")
184 (synopsis "The Python timezone library.")
185 (description
186 "This library allows accurate and cross platform timezone calculations
187 using Python 2.4 or higher and provides access to the Olson timezone database.")
188 (license x11)))
189
190 (define-public babel
191 (package
192 (name "babel")
193 (version "0.9.6")
194 (source
195 (origin
196 (method url-fetch)
197 (uri (string-append "http://ftp.edgewall.com/pub/babel/Babel-"
198 version ".tar.gz"))
199 (sha256
200 (base32
201 "03vmr54jq5vf3qw6kpdv7cdk7x7i2jhzyf1mawv2gk8zrxg0hfja"))))
202 (build-system python-build-system)
203 (inputs
204 `(("pytz" ,pytz)))
205 (home-page "http://babel.edgewall.org/")
206 (synopsis
207 "Tools for internationalizing Python applications")
208 (description
209 "Babel is composed of two major parts:
210 - tools to build and work with gettext message catalogs
211 - a Python interface to the CLDR (Common Locale Data Repository), providing
212 access to various locale display names, localized number and date formatting,
213 etc. ")
214 (license bsd-3)))