Commit | Line | Data |
---|---|---|
a01b6da7 NK |
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> | |
af807dea | 4 | ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr> |
a01b6da7 NK |
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 | ||
1ffa7090 | 21 | (define-module (gnu packages python) |
5ace6e2f | 22 | #:use-module ((guix licenses) #:select (bsd-3 psfl x11)) |
3fdc99da | 23 | #:use-module (gnu packages) |
1ffa7090 | 24 | #:use-module (gnu packages compression) |
3fdc99da CR |
25 | #:use-module (gnu packages gdbm) |
26 | #:use-module (gnu packages readline) | |
1ffa7090 | 27 | #:use-module (gnu packages openssl) |
fd982732 | 28 | #:use-module (gnu packages patchelf) |
a01b6da7 NK |
29 | #:use-module (guix packages) |
30 | #:use-module (guix download) | |
11bb85a1 | 31 | #:use-module (guix utils) |
acc26ff1 | 32 | #:use-module (guix build-system gnu) |
898238b9 AE |
33 | #:use-module (guix build-system python) |
34 | #:use-module (guix build-system trivial)) | |
a01b6da7 | 35 | |
b24d1cfc | 36 | (define-public python-2 |
a01b6da7 NK |
37 | (package |
38 | (name "python") | |
af807dea | 39 | (version "2.7.5") |
a01b6da7 NK |
40 | (source |
41 | (origin | |
42 | (method url-fetch) | |
43 | (uri (string-append "http://www.python.org/ftp/python/" | |
44 | version "/Python-" version ".tar.xz")) | |
45 | (sha256 | |
46 | (base32 | |
af807dea | 47 | "1c8xan2dlsqfq8q82r3mhl72v3knq3qyn71fjq89xikx2smlqg7k")))) |
a01b6da7 | 48 | (build-system gnu-build-system) |
3fdc99da | 49 | (arguments |
af807dea AE |
50 | `(#:tests? #f |
51 | ;; 258 tests OK. | |
52 | ;; 103 tests failed: | |
53 | ;; test_bz2 test_distutils test_file test_file2k test_popen2 | |
54 | ;; test_shutil test_signal test_site test_slice test_smtplib | |
55 | ;; test_smtpnet test_socket test_socketserver test_softspace | |
56 | ;; test_sort test_sqlite test_ssl test_startfile test_str | |
57 | ;; test_strftime test_string test_stringprep test_strop test_strptime | |
58 | ;; test_strtod test_struct test_structmembers test_structseq | |
59 | ;; test_subprocess test_sunaudiodev test_sundry test_symtable | |
60 | ;; test_syntax test_sys test_sys_setprofile test_sys_settrace | |
61 | ;; test_sysconfig test_tarfile test_tcl test_telnetlib test_tempfile | |
62 | ;; test_textwrap test_thread test_threaded_import | |
63 | ;; test_threadedtempfile test_threading test_threading_local | |
64 | ;; test_threadsignals test_time test_timeout test_tk test_tokenize | |
65 | ;; test_tools test_trace test_traceback test_transformer | |
66 | ;; test_ttk_guionly test_ttk_textonly test_tuple test_typechecks | |
67 | ;; test_ucn test_unary test_undocumented_details test_unicode | |
68 | ;; test_unicode_file test_unicodedata test_univnewlines | |
69 | ;; test_univnewlines2k test_unpack test_urllib test_urllib2 | |
70 | ;; test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse | |
71 | ;; test_userdict test_userlist test_userstring test_uu test_uuid | |
72 | ;; test_wait3 test_wait4 test_warnings test_wave test_weakref | |
73 | ;; test_weakset test_whichdb test_winreg test_winsound test_with | |
74 | ;; test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c | |
75 | ;; test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile | |
76 | ;; test_zipfile64 test_zipimport test_zipimport_support test_zlib | |
77 | ;; 31 tests skipped: | |
78 | ;; test_aepack test_al test_applesingle test_ascii_formatd test_bsddb | |
79 | ;; test_bsddb185 test_bsddb3 test_cd test_cl test_codecmaps_cn | |
80 | ;; test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr | |
81 | ;; test_codecmaps_tw test_ctypes test_curses test_dl test_gdb test_gl | |
82 | ;; test_imageop test_imgfile test_ioctl test_kqueue | |
83 | ;; test_linuxaudiodev test_macos test_macostools test_msilib | |
84 | ;; test_multiprocessing test_ossaudiodev test_pep277 | |
85 | ;; test_scriptpackages | |
86 | ;; 7 skips unexpected on linux2: | |
87 | ;; test_ascii_formatd test_bsddb test_bsddb3 test_ctypes test_gdb | |
88 | ;; test_ioctl test_multiprocessing | |
89 | ;; One of the typical errors: | |
90 | ;; test_unicode | |
91 | ;; test test_unicode crashed -- <type 'exceptions.OSError'>: [Errno 2] No such file or directory | |
92 | #:test-target "test" | |
3fdc99da CR |
93 | #:configure-flags |
94 | (let ((bz2 (assoc-ref %build-inputs "bzip2")) | |
95 | (gdbm (assoc-ref %build-inputs "gdbm")) | |
96 | (openssl (assoc-ref %build-inputs "openssl")) | |
97 | (readline (assoc-ref %build-inputs "readline")) | |
98 | (zlib (assoc-ref %build-inputs "zlib"))) | |
fd982732 LC |
99 | (list "--enable-shared" ; allow embedding |
100 | (string-append "CPPFLAGS=" | |
3fdc99da CR |
101 | "-I" bz2 "/include " |
102 | "-I" gdbm "/include " | |
103 | "-I" openssl "/include " | |
104 | "-I" readline "/include " | |
105 | "-I" zlib "/include") | |
106 | (string-append "LDFLAGS=" | |
107 | "-L" bz2 "/lib " | |
108 | "-L" gdbm "/lib " | |
109 | "-L" openssl "/lib " | |
110 | "-L" readline "/lib " | |
fd982732 LC |
111 | "-L" zlib "/lib"))) |
112 | ||
113 | #:modules ((guix build gnu-build-system) | |
114 | (guix build utils) | |
3309e3a1 | 115 | (guix build rpath) |
fd982732 | 116 | (srfi srfi-26)) |
3309e3a1 LC |
117 | #:imported-modules ((guix build gnu-build-system) |
118 | (guix build utils) | |
119 | (guix build rpath)) | |
fd982732 LC |
120 | |
121 | #:phases | |
122 | (alist-cons-after | |
123 | 'strip 'add-lib-to-runpath | |
124 | (lambda* (#:key outputs #:allow-other-keys) | |
fd982732 LC |
125 | (let* ((out (assoc-ref outputs "out")) |
126 | (lib (string-append out "/lib"))) | |
127 | ;; Add LIB to the RUNPATH of all the executables. | |
128 | (with-directory-excursion out | |
129 | (for-each (cut augment-rpath <> lib) | |
130 | (find-files "bin" ".*"))))) | |
131 | %standard-phases))) | |
a01b6da7 | 132 | (inputs |
3fdc99da CR |
133 | `(("bzip2" ,bzip2) |
134 | ("gdbm" ,gdbm) | |
a01b6da7 | 135 | ("openssl" ,openssl) |
3fdc99da | 136 | ("readline" ,readline) |
fd982732 | 137 | ("zlib" ,zlib) |
3309e3a1 | 138 | ("patchelf" ,patchelf))) ; for (guix build rpath) |
9be8d7c8 LC |
139 | (native-search-paths |
140 | (list (search-path-specification | |
141 | (variable "PYTHONPATH") | |
142 | (directories '("lib/python2.7/site-packages"))))) | |
a01b6da7 NK |
143 | (home-page "http://python.org") |
144 | (synopsis | |
145 | "Python, a high-level dynamically-typed programming language") | |
146 | (description | |
147 | "Python is a remarkably powerful dynamic programming language that | |
148 | is used in a wide variety of application domains. Some of its key | |
149 | distinguishing features include: clear, readable syntax; strong | |
150 | introspection capabilities; intuitive object orientation; natural | |
151 | expression of procedural code; full modularity, supporting hierarchical | |
152 | packages; exception-based error handling; and very high level dynamic | |
153 | data types.") | |
154 | (license psfl))) | |
acc26ff1 | 155 | |
b24d1cfc AE |
156 | (define-public python |
157 | (package (inherit python-2) | |
f26a77ff AE |
158 | (version "3.3.2") |
159 | (source | |
160 | (origin | |
161 | (method url-fetch) | |
162 | (uri (string-append "http://www.python.org/ftp/python/" | |
163 | version "/Python-" version ".tar.xz")) | |
164 | (sha256 | |
165 | (base32 | |
1aebc0cb AE |
166 | "0hsbwqjnhr85a2w252c8d3yj8d9i5sy8s6a6cfk6zqqhp3234nvl")))) |
167 | (native-search-paths | |
168 | (list (search-path-specification | |
169 | (variable "PYTHONPATH") | |
170 | (directories '("lib/python3.3/site-packages"))))))) | |
f26a77ff | 171 | |
898238b9 AE |
172 | (define-public python-wrapper |
173 | (package (inherit python) | |
174 | (name "python-wrapper") | |
175 | (source #f) | |
176 | (build-system trivial-build-system) | |
177 | (inputs `(("python" ,python))) | |
178 | (arguments | |
179 | `(#:modules ((guix build utils)) | |
180 | #:builder | |
181 | (begin | |
182 | (use-modules (guix build utils)) | |
183 | (let ((bin (string-append (assoc-ref %outputs "out") "/bin")) | |
184 | (python (string-append (assoc-ref %build-inputs "python") "/bin/"))) | |
185 | (mkdir-p bin) | |
186 | (for-each | |
187 | (lambda (old new) | |
188 | (symlink (string-append python old) | |
189 | (string-append bin "/" new))) | |
190 | `("python3", "pydoc3", "idle3") | |
191 | `("python", "pydoc", "idle")))))) | |
192 | (description (string-append (package-description python) | |
193 | "\n\nThis wrapper package provides symbolic links to the python binaries | |
194 | without version suffix.")))) | |
195 | ||
196 | ||
89114f39 | 197 | (define-public python-pytz |
acc26ff1 | 198 | (package |
89114f39 | 199 | (name "python-pytz") |
acc26ff1 CR |
200 | (version "2013b") |
201 | (source | |
202 | (origin | |
203 | (method url-fetch) | |
204 | (uri (string-append "https://launchpad.net/pytz/main/" version | |
205 | "/+download/pytz-" version ".tar.bz2")) | |
206 | (sha256 | |
207 | (base32 | |
208 | "19giwgfcrg0nr1gdv49qnmf2jb2ilkcfc7qyqvfpz4dp0p64ksv5")))) | |
209 | (build-system python-build-system) | |
8498b8cf | 210 | (arguments `(#:tests? #f)) ; no test target |
acc26ff1 CR |
211 | (home-page "https://launchpad.net/pytz") |
212 | (synopsis "The Python timezone library.") | |
213 | (description | |
214 | "This library allows accurate and cross platform timezone calculations | |
215 | using Python 2.4 or higher and provides access to the Olson timezone database.") | |
216 | (license x11))) | |
5ace6e2f | 217 | |
89114f39 | 218 | (define-public python2-pytz |
11bb85a1 | 219 | (package-with-python2 python-pytz)) |
89114f39 | 220 | |
fc50e9c6 | 221 | |
89114f39 | 222 | (define-public python-babel |
5ace6e2f | 223 | (package |
89114f39 | 224 | (name "python-babel") |
e1804763 | 225 | (version "1.3") |
5ace6e2f CR |
226 | (source |
227 | (origin | |
228 | (method url-fetch) | |
e1804763 | 229 | (uri (string-append "https://pypi.python.org/packages/source/B/Babel/Babel-" |
5ace6e2f CR |
230 | version ".tar.gz")) |
231 | (sha256 | |
232 | (base32 | |
e1804763 | 233 | "0bnin777lc53nxd1hp3apq410jj5wx92n08h7h4izpl4f4sx00lz")))) |
5ace6e2f CR |
234 | (build-system python-build-system) |
235 | (inputs | |
e1804763 AE |
236 | `(("python-pytz" ,python-pytz) |
237 | ("python-setuptools" ,python-setuptools))) | |
8498b8cf | 238 | (arguments `(#:tests? #f)) ; no test target |
e1804763 | 239 | (home-page "http://babel.pocoo.org/") |
5ace6e2f CR |
240 | (synopsis |
241 | "Tools for internationalizing Python applications") | |
242 | (description | |
243 | "Babel is composed of two major parts: | |
244 | - tools to build and work with gettext message catalogs | |
245 | - a Python interface to the CLDR (Common Locale Data Repository), providing | |
246 | access to various locale display names, localized number and date formatting, | |
247 | etc. ") | |
248 | (license bsd-3))) | |
89114f39 AE |
249 | |
250 | (define-public python2-babel | |
11bb85a1 | 251 | (package-with-python2 python-babel)) |
73adf220 | 252 | |
fc50e9c6 | 253 | |
73adf220 AE |
254 | (define-public python-setuptools |
255 | (package | |
256 | (name "python-setuptools") | |
257 | (version "1.1.4") | |
258 | (source | |
259 | (origin | |
260 | (method url-fetch) | |
261 | (uri (string-append "https://pypi.python.org/packages/source/s/setuptools/setuptools-" | |
262 | version ".tar.gz")) | |
263 | (sha256 | |
264 | (base32 | |
265 | "0hl9sa5xr9bi2ifq51wy1bawsjv5nzvpbac7m9z1ciz778874csf")))) | |
266 | (build-system python-build-system) | |
267 | (arguments | |
824af8ca | 268 | `(#:tests? #f)) |
73adf220 AE |
269 | ;;FIXME: test_sdist_with_utf8_encoded_filename fails in |
270 | ;; /tmp/nix-build-python2-setuptools-1.1.4.drv-0/setuptools-1.1.4/setuptools/tests/test_sdist.py" | |
271 | ;; line 354 | |
272 | ;; The tests pass with Python 2.7.5. | |
73adf220 AE |
273 | (home-page "https://pypi.python.org/pypi/setuptools") |
274 | (synopsis | |
275 | "Library designed to facilitate packaging Python projects") | |
276 | (description | |
277 | "Setuptools is a fully-featured, stable library designed to facilitate | |
278 | packaging Python projects, where packaging includes: | |
279 | Python package and module definitions, | |
280 | distribution package metadata, | |
281 | test hooks, | |
282 | project installation, | |
283 | platform-specific details, | |
284 | Python 3 support.") | |
285 | (license psfl))) | |
286 | ||
287 | (define-public python2-setuptools | |
288 | (package-with-python2 python-setuptools)) | |
fc50e9c6 AE |
289 | |
290 | ||
291 | (define-public python-dateutil | |
292 | (package | |
293 | (name "python-dateutil") | |
294 | (version "1.5") ; last version for python < 3 | |
295 | (source | |
296 | (origin | |
297 | (method url-fetch) | |
298 | (uri (string-append "http://labix.org/download/python-dateutil/python-dateutil-" | |
299 | version ".tar.gz")) | |
300 | (sha256 | |
301 | (base32 | |
302 | "0fqfglhy5khbvsipr3x7m6bcaqljh8xl5cw33vbfxy7qhmywm2n0")))) | |
303 | (build-system python-build-system) | |
304 | (inputs | |
305 | `(("python-setuptools" ,python-setuptools))) | |
306 | (home-page "http://labix.org/python-dateutil") | |
307 | (synopsis | |
308 | "Extensions to the standard datetime module, available in Python 2.3+") | |
309 | (description | |
310 | "The dateutil module provides powerful extensions to the standard | |
311 | datetime module, available in Python 2.3+.") | |
312 | (license psfl))) | |
313 | ||
314 | (define-public python2-dateutil | |
315 | (package-with-python2 python-dateutil)) |