You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

530 lines
20 KiB

  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. (define-module (gnu packages python)
  21. #:use-module ((guix licenses)
  22. #:select (bsd-3 bsd-style psfl x11 gpl2+ lgpl2.1+))
  23. #:use-module ((guix licenses) #:select (zlib)
  24. #:renamer (symbol-prefix-proc 'license:))
  25. #:use-module (gnu packages)
  26. #:use-module (gnu packages compression)
  27. #:use-module (gnu packages gdbm)
  28. #:use-module (gnu packages icu4c)
  29. #:use-module (gnu packages readline)
  30. #:use-module (gnu packages openssl)
  31. #:use-module (gnu packages patchelf)
  32. #:use-module (gnu packages sqlite)
  33. #:use-module (guix packages)
  34. #:use-module (guix download)
  35. #:use-module (guix utils)
  36. #:use-module (guix build-system gnu)
  37. #:use-module (guix build-system python)
  38. #:use-module (guix build-system trivial))
  39. (define-public python-2
  40. (package
  41. (name "python")
  42. (version "2.7.5")
  43. (source
  44. (origin
  45. (method url-fetch)
  46. (uri (string-append "http://www.python.org/ftp/python/"
  47. version "/Python-" version ".tar.xz"))
  48. (sha256
  49. (base32
  50. "1c8xan2dlsqfq8q82r3mhl72v3knq3qyn71fjq89xikx2smlqg7k"))))
  51. (build-system gnu-build-system)
  52. (arguments
  53. `(#:tests? #f
  54. ;; 258 tests OK.
  55. ;; 103 tests failed:
  56. ;; test_bz2 test_distutils test_file test_file2k test_popen2
  57. ;; test_shutil test_signal test_site test_slice test_smtplib
  58. ;; test_smtpnet test_socket test_socketserver test_softspace
  59. ;; test_sort test_sqlite test_ssl test_startfile test_str
  60. ;; test_strftime test_string test_stringprep test_strop test_strptime
  61. ;; test_strtod test_struct test_structmembers test_structseq
  62. ;; test_subprocess test_sunaudiodev test_sundry test_symtable
  63. ;; test_syntax test_sys test_sys_setprofile test_sys_settrace
  64. ;; test_sysconfig test_tarfile test_tcl test_telnetlib test_tempfile
  65. ;; test_textwrap test_thread test_threaded_import
  66. ;; test_threadedtempfile test_threading test_threading_local
  67. ;; test_threadsignals test_time test_timeout test_tk test_tokenize
  68. ;; test_tools test_trace test_traceback test_transformer
  69. ;; test_ttk_guionly test_ttk_textonly test_tuple test_typechecks
  70. ;; test_ucn test_unary test_undocumented_details test_unicode
  71. ;; test_unicode_file test_unicodedata test_univnewlines
  72. ;; test_univnewlines2k test_unpack test_urllib test_urllib2
  73. ;; test_urllib2_localnet test_urllib2net test_urllibnet test_urlparse
  74. ;; test_userdict test_userlist test_userstring test_uu test_uuid
  75. ;; test_wait3 test_wait4 test_warnings test_wave test_weakref
  76. ;; test_weakset test_whichdb test_winreg test_winsound test_with
  77. ;; test_wsgiref test_xdrlib test_xml_etree test_xml_etree_c
  78. ;; test_xmllib test_xmlrpc test_xpickle test_xrange test_zipfile
  79. ;; test_zipfile64 test_zipimport test_zipimport_support test_zlib
  80. ;; 31 tests skipped:
  81. ;; test_aepack test_al test_applesingle test_ascii_formatd test_bsddb
  82. ;; test_bsddb185 test_bsddb3 test_cd test_cl test_codecmaps_cn
  83. ;; test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
  84. ;; test_codecmaps_tw test_ctypes test_curses test_dl test_gdb test_gl
  85. ;; test_imageop test_imgfile test_ioctl test_kqueue
  86. ;; test_linuxaudiodev test_macos test_macostools test_msilib
  87. ;; test_multiprocessing test_ossaudiodev test_pep277
  88. ;; test_scriptpackages
  89. ;; 7 skips unexpected on linux2:
  90. ;; test_ascii_formatd test_bsddb test_bsddb3 test_ctypes test_gdb
  91. ;; test_ioctl test_multiprocessing
  92. ;; One of the typical errors:
  93. ;; test_unicode
  94. ;; test test_unicode crashed -- <type 'exceptions.OSError'>: [Errno 2] No such file or directory
  95. #:test-target "test"
  96. #:configure-flags
  97. (let ((bz2 (assoc-ref %build-inputs "bzip2"))
  98. (gdbm (assoc-ref %build-inputs "gdbm"))
  99. (openssl (assoc-ref %build-inputs "openssl"))
  100. (readline (assoc-ref %build-inputs "readline"))
  101. (zlib (assoc-ref %build-inputs "zlib")))
  102. (list "--enable-shared" ; allow embedding
  103. (string-append "CPPFLAGS="
  104. "-I" bz2 "/include "
  105. "-I" gdbm "/include "
  106. "-I" openssl "/include "
  107. "-I" readline "/include "
  108. "-I" zlib "/include")
  109. (string-append "LDFLAGS="
  110. "-L" bz2 "/lib "
  111. "-L" gdbm "/lib "
  112. "-L" openssl "/lib "
  113. "-L" readline "/lib "
  114. "-L" zlib "/lib")))
  115. #:modules ((guix build gnu-build-system)
  116. (guix build utils)
  117. (guix build rpath)
  118. (srfi srfi-26))
  119. #:imported-modules ((guix build gnu-build-system)
  120. (guix build utils)
  121. (guix build rpath))
  122. #:phases
  123. (alist-cons-after
  124. 'strip 'add-lib-to-runpath
  125. (lambda* (#:key outputs #:allow-other-keys)
  126. (let* ((out (assoc-ref outputs "out"))
  127. (lib (string-append out "/lib")))
  128. ;; Add LIB to the RUNPATH of all the executables.
  129. (with-directory-excursion out
  130. (for-each (cut augment-rpath <> lib)
  131. (find-files "bin" ".*")))))
  132. %standard-phases)))
  133. (inputs
  134. `(("bzip2" ,bzip2)
  135. ("gdbm" ,gdbm)
  136. ("openssl" ,openssl)
  137. ("readline" ,readline)
  138. ("zlib" ,zlib)
  139. ("patchelf" ,patchelf))) ; for (guix build rpath)
  140. (native-search-paths
  141. (list (search-path-specification
  142. (variable "PYTHONPATH")
  143. (directories '("lib/python2.7/site-packages")))))
  144. (home-page "http://python.org")
  145. (synopsis
  146. "Python, a high-level dynamically-typed programming language")
  147. (description
  148. "Python is a remarkably powerful dynamic programming language that
  149. is used in a wide variety of application domains. Some of its key
  150. distinguishing features include: clear, readable syntax; strong
  151. introspection capabilities; intuitive object orientation; natural
  152. expression of procedural code; full modularity, supporting hierarchical
  153. packages; exception-based error handling; and very high level dynamic
  154. data types.")
  155. (license psfl)))
  156. (define-public python
  157. (package (inherit python-2)
  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
  166. "0hsbwqjnhr85a2w252c8d3yj8d9i5sy8s6a6cfk6zqqhp3234nvl"))))
  167. (native-search-paths
  168. (list (search-path-specification
  169. (variable "PYTHONPATH")
  170. (directories '("lib/python3.3/site-packages")))))))
  171. (define-public python-wrapper
  172. (package (inherit python)
  173. (name "python-wrapper")
  174. (source #f)
  175. (build-system trivial-build-system)
  176. (inputs `(("python" ,python)))
  177. (arguments
  178. `(#:modules ((guix build utils))
  179. #:builder
  180. (begin
  181. (use-modules (guix build utils))
  182. (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
  183. (python (string-append (assoc-ref %build-inputs "python") "/bin/")))
  184. (mkdir-p bin)
  185. (for-each
  186. (lambda (old new)
  187. (symlink (string-append python old)
  188. (string-append bin "/" new)))
  189. `("python3", "pydoc3", "idle3")
  190. `("python", "pydoc", "idle"))))))
  191. (description (string-append (package-description python)
  192. "\n\nThis wrapper package provides symbolic links to the python binaries
  193. without version suffix."))))
  194. (define-public python-pytz
  195. (package
  196. (name "python-pytz")
  197. (version "2013b")
  198. (source
  199. (origin
  200. (method url-fetch)
  201. (uri (string-append "https://launchpad.net/pytz/main/" version
  202. "/+download/pytz-" version ".tar.bz2"))
  203. (sha256
  204. (base32
  205. "19giwgfcrg0nr1gdv49qnmf2jb2ilkcfc7qyqvfpz4dp0p64ksv5"))))
  206. (build-system python-build-system)
  207. (arguments `(#:tests? #f)) ; no test target
  208. (home-page "https://launchpad.net/pytz")
  209. (synopsis "The Python timezone library.")
  210. (description
  211. "This library allows accurate and cross platform timezone calculations
  212. using Python 2.4 or higher and provides access to the Olson timezone database.")
  213. (license x11)))
  214. (define-public python2-pytz
  215. (package-with-python2 python-pytz))
  216. (define-public python-babel
  217. (package
  218. (name "python-babel")
  219. (version "1.3")
  220. (source
  221. (origin
  222. (method url-fetch)
  223. (uri (string-append "https://pypi.python.org/packages/source/B/Babel/Babel-"
  224. version ".tar.gz"))
  225. (sha256
  226. (base32
  227. "0bnin777lc53nxd1hp3apq410jj5wx92n08h7h4izpl4f4sx00lz"))))
  228. (build-system python-build-system)
  229. (inputs
  230. `(("python-pytz" ,python-pytz)
  231. ("python-setuptools" ,python-setuptools)))
  232. (arguments `(#:tests? #f)) ; no test target
  233. (home-page "http://babel.pocoo.org/")
  234. (synopsis
  235. "Tools for internationalizing Python applications")
  236. (description
  237. "Babel is composed of two major parts:
  238. - tools to build and work with gettext message catalogs
  239. - a Python interface to the CLDR (Common Locale Data Repository), providing
  240. access to various locale display names, localized number and date formatting,
  241. etc. ")
  242. (license bsd-3)))
  243. (define-public python2-babel
  244. (package-with-python2 python-babel))
  245. (define-public python-setuptools
  246. (package
  247. (name "python-setuptools")
  248. (version "1.1.4")
  249. (source
  250. (origin
  251. (method url-fetch)
  252. (uri (string-append "https://pypi.python.org/packages/source/s/setuptools/setuptools-"
  253. version ".tar.gz"))
  254. (sha256
  255. (base32
  256. "0hl9sa5xr9bi2ifq51wy1bawsjv5nzvpbac7m9z1ciz778874csf"))))
  257. (build-system python-build-system)
  258. (arguments
  259. `(#:tests? #f))
  260. ;;FIXME: test_sdist_with_utf8_encoded_filename fails in
  261. ;; /tmp/nix-build-python2-setuptools-1.1.4.drv-0/setuptools-1.1.4/setuptools/tests/test_sdist.py"
  262. ;; line 354
  263. ;; The tests pass with Python 2.7.5.
  264. (home-page "https://pypi.python.org/pypi/setuptools")
  265. (synopsis
  266. "Library designed to facilitate packaging Python projects")
  267. (description
  268. "Setuptools is a fully-featured, stable library designed to facilitate
  269. packaging Python projects, where packaging includes:
  270. Python package and module definitions,
  271. distribution package metadata,
  272. test hooks,
  273. project installation,
  274. platform-specific details,
  275. Python 3 support.")
  276. (license psfl)))
  277. (define-public python2-setuptools
  278. (package-with-python2 python-setuptools))
  279. (define-public python-dateutil
  280. (package
  281. (name "python-dateutil")
  282. (version "1.5") ; last version for python < 3
  283. (source
  284. (origin
  285. (method url-fetch)
  286. (uri (string-append "http://labix.org/download/python-dateutil/python-dateutil-"
  287. version ".tar.gz"))
  288. (sha256
  289. (base32
  290. "0fqfglhy5khbvsipr3x7m6bcaqljh8xl5cw33vbfxy7qhmywm2n0"))))
  291. (build-system python-build-system)
  292. (inputs
  293. `(("python-setuptools" ,python-setuptools)))
  294. (home-page "http://labix.org/python-dateutil")
  295. (synopsis
  296. "Extensions to the standard datetime module, available in Python 2.3+")
  297. (description
  298. "The dateutil module provides powerful extensions to the standard
  299. datetime module, available in Python 2.3+.")
  300. (license psfl)))
  301. (define-public python2-dateutil
  302. (package-with-python2 python-dateutil))
  303. (define-public python2-pysqlite
  304. (package
  305. (name "python2-pysqlite")
  306. (version "2.6.3")
  307. (source
  308. (origin
  309. (method url-fetch)
  310. (uri (string-append "http://pysqlite.googlecode.com/files/pysqlite-"
  311. version ".tar.gz"))
  312. (sha256
  313. (base32
  314. "0nsqqfp072rgqbls100rdvbzkjkin7li3kprhfxlfqvzf608hlqd"))))
  315. (build-system python-build-system)
  316. (inputs
  317. `(("sqlite" ,sqlite)))
  318. (arguments
  319. `(#:python ,python-2 ; incompatible with Python 3
  320. #:tests? #f)) ; no test target
  321. (home-page "http://labix.org/python-dateutil")
  322. (synopsis
  323. "SQLite bindings for Python.")
  324. (description
  325. "Pysqlite provides SQLite bindings for Python that comply to the
  326. Database API 2.0T.")
  327. (license license:zlib)))
  328. (define-public python2-mechanize
  329. (package
  330. (name "python2-mechanize")
  331. (version "0.2.5")
  332. (source
  333. (origin
  334. (method url-fetch)
  335. (uri (string-append "https://pypi.python.org/packages/source/m/mechanize/mechanize-"
  336. version ".tar.gz"))
  337. (sha256
  338. (base32
  339. "0rj7r166i1dyrq0ihm5rijfmvhs8a04im28lv05c0c3v206v4rrf"))))
  340. (build-system python-build-system)
  341. (inputs
  342. `(("python2-setuptools" ,python2-setuptools)))
  343. (arguments
  344. `(#:python ,python-2 ; apparently incompatible with Python 3
  345. #:tests? #f))
  346. ;; test fails with message
  347. ;; AttributeError: 'module' object has no attribute 'test_pullparser'
  348. ;; (python-3.3.2) or
  349. ;; AttributeError: 'module' object has no attribute 'test_urllib2_localnet'
  350. ;; (python-2.7.5).
  351. ;; The source code is from March 2011 and probably not up-to-date
  352. ;; with respect to python unit tests.
  353. (home-page "http://wwwsearch.sourceforge.net/mechanize/")
  354. (synopsis
  355. "Stateful programmatic web browsing in Python")
  356. (description
  357. "Mechanize implements stateful programmatic web browsing in Python,
  358. after Andy Lester’s Perl module WWW::Mechanize.")
  359. (license (bsd-style "file://COPYING"
  360. "See COPYING in the distribution."))))
  361. (define-public python-simplejson
  362. (package
  363. (name "python-simplejson")
  364. (version "3.3.0")
  365. (source
  366. (origin
  367. (method url-fetch)
  368. (uri (string-append "https://pypi.python.org/packages/source/s/simplejson/simplejson-"
  369. version ".tar.gz"))
  370. (sha256
  371. (base32
  372. "07wsry5j44l5zzm74l4j2bvasiq8n5m32f31n2p7c68i5vc6p2ks"))))
  373. (build-system python-build-system)
  374. (home-page "http://simplejson.readthedocs.org/en/latest/")
  375. (synopsis
  376. "Json library for Python")
  377. (description
  378. "JSON (JavaScript Object Notation) is a subset of JavaScript syntax
  379. (ECMA-262 3rd edition) used as a lightweight data interchange format.
  380. Simplejson exposes an API familiar to users of the standard library marshal
  381. and pickle modules. It is the externally maintained version of the json
  382. library contained in Python 2.6, but maintains compatibility with Python 2.5
  383. and (currently) has significant performance advantages, even without using
  384. the optional C extension for speedups. Simplejson is also supported on
  385. Python 3.3+.")
  386. (license x11)))
  387. (define-public python2-simplejson
  388. (package-with-python2 python-simplejson))
  389. (define-public python2-pyicu
  390. (package
  391. (name "python2-pyicu")
  392. (version "1.5")
  393. (source
  394. (origin
  395. (method url-fetch)
  396. (uri (string-append "https://pypi.python.org/packages/source/P/PyICU/PyICU-"
  397. version ".tar.gz"))
  398. (sha256
  399. (base32
  400. "011vwflpir8wvh48mvi6d9a7vw0f43bkwv0w6bzxbzmvz20ax5vm"))))
  401. (build-system python-build-system)
  402. (inputs
  403. `(("icu4c" ,icu4c)))
  404. (arguments
  405. `(#:python ,python-2 ; Python 3 works also, but needs special care for
  406. ; linking with libpython3.3m
  407. #:tests? #f)) ; no check target
  408. (home-page "http://pyicu.osafoundation.org/")
  409. (synopsis
  410. "Python extension wrapping the ICU C++ API.")
  411. (description
  412. "PyICU is a python extension wrapping the ICU C++ API.")
  413. (license x11)))
  414. (define-public python2-dogtail
  415. ;; Python 2 only, as it leads to "TabError: inconsistent use of tabs and
  416. ;; spaces in indentation" with Python 3.
  417. (package
  418. (name "python2-dogtail")
  419. (version "0.8.2")
  420. (source (origin
  421. (method url-fetch)
  422. (uri (string-append
  423. "https://fedorahosted.org/released/dogtail/dogtail-"
  424. version ".tar.gz"))
  425. (sha256
  426. (base32
  427. "1yc4cg7ip87z15gyd4wy2vzbywrjc52a3m8r8gqy2b50d65llcg1"))))
  428. (build-system python-build-system)
  429. (arguments `(#:python ,python-2
  430. #:tests? #f)) ; invalid command "test"
  431. (home-page "https://fedorahosted.org/dogtail/")
  432. (synopsis "GUI test tool and automation framework written in ​Python")
  433. (description
  434. "dogtail is a GUI test tool and automation framework written in Python.
  435. It uses Accessibility (a11y) technologies to communicate with desktop
  436. applications. dogtail scripts are written in Python and executed like any
  437. other Python program.")
  438. (license gpl2+)))
  439. (define-public python2-empy
  440. (package
  441. (name "python2-empy")
  442. (version "3.3")
  443. (source (origin
  444. (method url-fetch)
  445. (uri (string-append "http://www.alcyone.com/software/empy/empy-"
  446. version ".tar.gz"))
  447. (sha256
  448. (base32
  449. "01g8mmkfnvjdmlhsihwyx56lrg7r5m5d2fg6mnxsvy6g0dnl69f6"))))
  450. (build-system python-build-system)
  451. (arguments
  452. `(#:python ,python-2
  453. #:phases (alist-replace
  454. 'check
  455. (lambda _
  456. (zero? (system* "./test.sh")))
  457. %standard-phases)))
  458. (home-page "http://www.alcyone.com/software/empy/")
  459. (synopsis "Templating system for Python")
  460. (description
  461. "EmPy is a system for embedding Python expressions and statements in
  462. template text; it takes an EmPy source file, processes it, and produces
  463. output. This is accomplished via expansions, which are special signals to the
  464. EmPy system and are set off by a special prefix (by default the at sign, @).
  465. EmPy can expand arbitrary Python expressions and statements in this way, as
  466. well as a variety of special forms. Textual data not explicitly delimited in
  467. this way is sent unaffected to the output, allowing Python to be used in
  468. effect as a markup language. Also supported are callbacks via hooks,
  469. recording and playback via diversions, and dynamic, chainable filters. The
  470. system is highly configurable via command line options and embedded
  471. commands.")
  472. (license lgpl2.1+)))
  473. (define-public scons
  474. (package
  475. (name "scons")
  476. (version "2.1.0")
  477. (source (origin
  478. (method url-fetch)
  479. (uri (string-append "mirror://sourceforge/scons/scons-"
  480. version ".tar.gz"))
  481. (sha256
  482. (base32
  483. "07cjn4afb2cljjrd3cr7xf062qq58z8q96f58z6yplhdyqafsfa1"))))
  484. (build-system python-build-system)
  485. (arguments
  486. ;; With Python 3.x, fails to build with a syntax error.
  487. `(#:python ,python-2
  488. #:tests? #f)) ; no 'python setup.py test' command
  489. (home-page "http://scons.org/")
  490. (synopsis "Software construction tool written in Python")
  491. (description
  492. "SCons is a software construction tool. Think of SCons as an improved,
  493. cross-platform substitute for the classic Make utility with integrated
  494. functionality similar to autoconf/automake and compiler caches such as ccache.
  495. In short, SCons is an easier, more reliable and faster way to build
  496. software.")
  497. (license x11)))