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.

453 lines
15 KiB

  1. (define-module (gn packages python24)
  2. #:use-module ((guix licenses) #:prefix license:)
  3. #:use-module (guix utils)
  4. #:use-module (guix packages)
  5. #:use-module (guix download)
  6. #:use-module (guix build-system python)
  7. #:use-module (gn packages python)
  8. #:use-module (past packages python)
  9. #:use-module (gnu packages compression)
  10. #:use-module (gnu packages maths)
  11. #:use-module (gnu packages python-xyz)
  12. #:use-module (srfi srfi-1))
  13. (define (default-python2.4)
  14. "Return the default Python-2.4 package."
  15. ;; Lazily resolve the binding.
  16. (let ((python (resolve-interface '(past packages python))))
  17. (module-ref python 'python-2.4)))
  18. ;; We borrow this from (guix build-system python) since we cannot refer to it
  19. ;; with the magic '@@' symbol since Guix has switched to guile-3.0.
  20. (define* (package-with-explicit-python python old-prefix new-prefix
  21. #:key variant-property)
  22. "Return a procedure of one argument, P. The procedure creates a package with
  23. the same fields as P, which is assumed to use PYTHON-BUILD-SYSTEM, such that
  24. it is compiled with PYTHON instead. The inputs are changed recursively
  25. accordingly. If the name of P starts with OLD-PREFIX, this is replaced by
  26. NEW-PREFIX; otherwise, NEW-PREFIX is prepended to the name.
  27. When VARIANT-PROPERTY is present, it is used as a key to search for
  28. pre-defined variants of this transformation recorded in the 'properties' field
  29. of packages. The property value must be the promise of a package. This is a
  30. convenient way for package writers to force the transformation to use
  31. pre-defined variants."
  32. (define package-variant
  33. (if variant-property
  34. (lambda (package)
  35. (assq-ref (package-properties package)
  36. variant-property))
  37. (const #f)))
  38. (define (transform p)
  39. (cond
  40. ;; If VARIANT-PROPERTY is present, use that.
  41. ((package-variant p)
  42. => force)
  43. ;; Otherwise build the new package object graph.
  44. ((eq? (package-build-system p) python-build-system)
  45. (package
  46. (inherit p)
  47. (location (package-location p))
  48. (name (let ((name (package-name p)))
  49. (string-append new-prefix
  50. (if (string-prefix? old-prefix name)
  51. (substring name
  52. (string-length old-prefix))
  53. name))))
  54. (arguments
  55. (let ((python (if (promise? python)
  56. (force python)
  57. python)))
  58. (ensure-keyword-arguments (package-arguments p)
  59. `(#:python ,python))))))
  60. (else p)))
  61. (define (cut? p)
  62. (or (not (eq? (package-build-system p) python-build-system))
  63. (package-variant p)))
  64. (package-mapping transform cut?))
  65. (define package-with-python24
  66. (package-with-explicit-python (delay (default-python2.4))
  67. "python-" "python24-"
  68. #:variant-property 'python24-variant))
  69. (define (strip-python24-variant p)
  70. (package
  71. (inherit p)
  72. (properties (alist-delete 'python24-variant (package-properties p)))))
  73. (define-public python24-htmlgen
  74. (package
  75. (name "python24-htmlgen")
  76. (version "0.9")
  77. ;(version "0.99")
  78. (source
  79. (origin
  80. (method url-fetch)
  81. (uri (pypi-uri "htmlgen" version))
  82. (sha256
  83. (base32
  84. "14xzjgwdqgs1vs5mq7mg3w48snvgb77yywv64mg8k6qhapmnafdw"))))
  85. ;"1kbn6jcbf2mpb9f8hm5gcsipy7habqrq4794lpdbzm5mqxlclmnl"))))
  86. (build-system python-build-system)
  87. (arguments
  88. `(#:python ,python-2.4))
  89. (native-inputs
  90. `(("python24-setuptools" ,python24-setuptools)))
  91. (propagated-inputs
  92. `(("python24-asserts" ,python24-asserts)))
  93. (home-page "https://github.com/srittau/python-htmlgen")
  94. (synopsis "Python HTML 5 Generator")
  95. (description "Python-htmlgen is a library to generate HTML from classes.")
  96. (license license:expat)))
  97. (define-public python24-setuptools
  98. (package
  99. (inherit python-setuptools)
  100. (name "python24-setuptools")
  101. (version "1.4.2")
  102. (source
  103. (origin
  104. (method url-fetch)
  105. (uri (pypi-uri "setuptools" version))
  106. (sha256
  107. (base32
  108. "1gfvalhvzcskwj85r3lh9sx190f8k807vz5zln8agaw31ak8cf96"))))
  109. (arguments
  110. `(#:python ,python-2.4
  111. #:tests? #f)))) ; skip the tests
  112. (define-public python24-asserts
  113. (package
  114. (name "python24-asserts")
  115. (version "0.6")
  116. (source
  117. (origin
  118. (method url-fetch)
  119. (uri (pypi-uri "asserts" version))
  120. (sha256
  121. (base32
  122. "05ffy111giwv6sqx97vzzsvcra0gxzx2ilv16gyw135v583frxbn"))))
  123. (build-system python-build-system)
  124. (arguments
  125. `(#:python ,python-2.4))
  126. (native-inputs
  127. `(("python24-setuptools" ,python24-setuptools)))
  128. (home-page "https://github.com/srittau/python-asserts")
  129. (synopsis "Stand-alone Assertions for Python")
  130. (description "Stand-alone Assertions for Python")
  131. (license license:expat)))
  132. (define-public python24-pyx
  133. (package
  134. (name "python24-pyx")
  135. (version "0.12.1")
  136. (source
  137. (origin
  138. (method url-fetch)
  139. (uri (pypi-uri "pyx" version))
  140. (sha256
  141. (base32
  142. "13kyhqx19rw7dlv2xapdb68j8l9laq6nrpgkyd6549qwidmb4dz8"))))
  143. (build-system python-build-system)
  144. (arguments
  145. `(#:python ,python-2.4))
  146. (native-inputs
  147. `(("python24-setuptools" ,python24-setuptools)))
  148. (home-page "http://pyx.sourceforge.net/")
  149. (synopsis "Python package for the generation of PostScript, PDF, and SVG files")
  150. (description "Python package for the generation of PostScript, PDF, and SVG files")
  151. (license license:gpl2+)))
  152. (define-public python24-pyxlwriter
  153. (package
  154. (name "python24-pyxlwriter")
  155. (version "0.4a3")
  156. (source
  157. (origin
  158. (method url-fetch)
  159. (uri (string-append "mirror://sourceforge/pyxlwriter/pyxlwriter/"
  160. version "/pyXLWriter-" version ".zip"))
  161. (sha256
  162. (base32
  163. "1kfsi6la9y53rwayszgayfmkjfknpp650v69a0hwd1fcfk1df735"))))
  164. (build-system python-build-system)
  165. (arguments
  166. `(#:python ,python-2.4
  167. #:use-setuptools? #f
  168. #:tests? #f)) ; no tests
  169. (native-inputs
  170. `(("unzip" ,unzip)))
  171. (home-page "https://sourceforge.net/projects/pyxlwriter/")
  172. (synopsis "Python library for generating Excel compatible spreadsheets")
  173. (description "PyXLWriter is a Python library for generating Excel compatible
  174. spreadsheets. It's a port of John McNamara's Perl @code{Spreadsheet::WriteExcel}
  175. module version 1.01 to Python. It allows writing of Excel compatible
  176. spreadsheets without the need for COM objects.")
  177. (license license:lgpl2.1+)))
  178. (define-public python24-pil
  179. (package
  180. (inherit python2-pil1)
  181. (name "python24-pil")
  182. (arguments
  183. (substitute-keyword-arguments (package-arguments python2-pil1)
  184. ((#:python _) python-2.4)))))
  185. (define-public python24-piddle
  186. (package
  187. (inherit python2-piddle-gn)
  188. (name "python24-piddle")
  189. (arguments
  190. (substitute-keyword-arguments (package-arguments python2-piddle-gn)
  191. ((#:python _) python-2.4)))
  192. (native-inputs `(("python24-setuptools" ,python24-setuptools)))
  193. (propagated-inputs
  194. `(("python24-pil" ,python24-pil)))))
  195. ;; Apparently this is the library which mimics python-2.6+'s json library
  196. (define-public python24-simplejson
  197. (let ((base (package-with-python24 python-simplejson)))
  198. (package
  199. (inherit base)
  200. (version "2.0.9") ; last version to officially support python2.4
  201. (source
  202. (origin
  203. (method url-fetch)
  204. (uri (pypi-uri "simplejson" version))
  205. (sha256
  206. (base32
  207. "1vlkxibal9ljabybawnqr3jh6f6g21c5pbrzl65z9vwbfxhg9kdb"))))
  208. (native-inputs
  209. `(("python24-setuptools" ,python24-setuptools)
  210. ,@(package-native-inputs base))))))
  211. (define-public python24-pp
  212. (package
  213. (name "python24-pp")
  214. (version "1.6.1")
  215. (source
  216. (origin
  217. (method url-fetch)
  218. (uri (string-append
  219. "http://www.parallelpython.com/downloads/pp/pp-" version ".zip"))
  220. (sha256
  221. (base32
  222. "0qkxcyclz3vgwpl6xvsrg76q59dj0wwy8qx15567bafv659ypyb1"))))
  223. (build-system python-build-system)
  224. (arguments
  225. `(#:python ,python-2.4
  226. #:use-setuptools? #f
  227. #:tests? #f)) ; no tests
  228. (native-inputs
  229. `(("unzip" ,unzip)))
  230. (home-page "http://www.parallelpython.com")
  231. (synopsis "Parallel and distributed programming for Python")
  232. (description "PP is a python module which provides mechanism for parallel
  233. execution of python code on SMP (systems with multiple processors or cores) and
  234. clusters (computers connected via network).")
  235. (license license:bsd-3)))
  236. (define GN1-thirdparty-sources
  237. (origin
  238. (method url-fetch/tarbomb)
  239. ;; ipfs get QmTPwYT2pehdxdG1TiHEzVzLgbeuhJ4utXShuz3twA84AB
  240. (uri "file:///gnu/store/p33a2sh3x2nhiiphdw9nly80njg6p8fi-thirdparty.tgz")
  241. (file-name "GN1-thirdparty")
  242. (sha256
  243. (base32
  244. "0nnp6g412hjfrcn3k2yrfb14sxv06k0149whc7qmv678nyj5zhfa"))))
  245. (define-public python24-json-GN1
  246. (package
  247. (name "python24-json-GN1")
  248. (version "GN1")
  249. (source GN1-thirdparty-sources)
  250. (build-system python-build-system)
  251. (arguments
  252. `(#:python ,python-2.4
  253. #:phases
  254. (modify-phases %standard-phases
  255. (delete 'build)
  256. (delete 'check)
  257. (replace 'install
  258. (lambda* (#:key outputs #:allow-other-keys)
  259. (let* ((out (assoc-ref outputs "out"))
  260. (sitedir (string-append out "/lib/python2.4/site-packages/json/")))
  261. (mkdir-p sitedir)
  262. (copy-recursively "thirdparty/json" sitedir)
  263. #t))))))
  264. (home-page "")
  265. (synopsis "")
  266. (description "")
  267. (license license:lgpl2.1+)))
  268. (define-public python24-svg-GN1
  269. (package
  270. (name "python24-svg-GN1")
  271. (version "1.0")
  272. (source GN1-thirdparty-sources)
  273. (build-system python-build-system)
  274. (arguments
  275. `(#:python ,python-2.4
  276. #:phases
  277. (modify-phases %standard-phases
  278. (delete 'build)
  279. (delete 'check)
  280. (replace 'install
  281. (lambda* (#:key outputs #:allow-other-keys)
  282. (let* ((out (assoc-ref outputs "out"))
  283. (sitedir (string-append out "/lib/python2.4/site-packages/svg/")))
  284. (mkdir-p sitedir)
  285. (copy-recursively "thirdparty/svg" sitedir)
  286. #t))))))
  287. (home-page "")
  288. (synopsis "")
  289. (description "")
  290. (license license:bsd-4)))
  291. (define-public python24-htmlgen-GN1
  292. (package
  293. (name "python24-htmlgen-GN1")
  294. (version "2.5")
  295. (source GN1-thirdparty-sources)
  296. (build-system python-build-system)
  297. (arguments
  298. `(#:python ,python-2.4
  299. #:phases
  300. (modify-phases %standard-phases
  301. (delete 'build)
  302. (delete 'check)
  303. (replace 'install
  304. (lambda* (#:key outputs #:allow-other-keys)
  305. (let* ((out (assoc-ref outputs "out"))
  306. (sitedir (string-append out "/lib/python2.4/site-packages/htmlgen/")))
  307. (mkdir-p sitedir)
  308. (copy-recursively "thirdparty/htmlgen" sitedir)
  309. #t))))))
  310. (home-page "")
  311. (synopsis "")
  312. (description "")
  313. (license license:bsd-2))) ; I'm not actually sure, checked HTMLgen.py
  314. (define-public python24-pyx-GN1
  315. (package
  316. (name "python24-pyx-GN1")
  317. (version "0.8")
  318. (source GN1-thirdparty-sources)
  319. (build-system python-build-system)
  320. (arguments
  321. `(#:python ,python-2.4
  322. #:phases
  323. (modify-phases %standard-phases
  324. (delete 'build)
  325. (delete 'check)
  326. (replace 'install
  327. (lambda* (#:key outputs #:allow-other-keys)
  328. (let* ((out (assoc-ref outputs "out"))
  329. (sitedir (string-append out "/lib/python2.4/site-packages/pyx/")))
  330. (mkdir-p sitedir)
  331. (copy-recursively "thirdparty/pyx" sitedir)
  332. #t))))))
  333. (home-page "")
  334. (synopsis "")
  335. (description "")
  336. (license license:gpl2+)))
  337. (define-public python24-pyxlwriter-GN1
  338. (package
  339. (name "python24-pyxlwriter-GN1")
  340. (version "0.4a3")
  341. (source GN1-thirdparty-sources)
  342. (build-system python-build-system)
  343. (arguments
  344. `(#:python ,python-2.4
  345. #:phases
  346. (modify-phases %standard-phases
  347. (delete 'build)
  348. (delete 'check)
  349. (replace 'install
  350. (lambda* (#:key outputs #:allow-other-keys)
  351. (let* ((out (assoc-ref outputs "out"))
  352. (sitedir (string-append out "/lib/python2.4/site-packages/pyXLWriter/")))
  353. (mkdir-p sitedir)
  354. (copy-recursively "thirdparty/pyXLWriter" sitedir)
  355. #t))))))
  356. (home-page "")
  357. (synopsis "")
  358. (description "")
  359. (license license:lgpl2.1+)))
  360. (define-public python24-pp-GN1
  361. (package
  362. (name "python24-pp-GN1")
  363. (version "1.5.7")
  364. (source GN1-thirdparty-sources)
  365. (build-system python-build-system)
  366. (arguments
  367. `(#:python ,python-2.4
  368. #:use-setuptools? #f
  369. #:tests? #f
  370. #:phases
  371. (modify-phases %standard-phases
  372. (add-after 'unpack 'change-directory
  373. (lambda _
  374. (chdir "thirdparty/pp-1.5.7") #t)))))
  375. (home-page "")
  376. (synopsis "")
  377. (description "")
  378. (license license:bsd-3)))
  379. (define-public python24-numarray-GN1
  380. (package
  381. (name "python24-numarray-GN1")
  382. (version "1.5.2")
  383. (source GN1-thirdparty-sources)
  384. (build-system python-build-system)
  385. (arguments
  386. `(#:python ,python-2.4
  387. #:use-setuptools? #f
  388. #:phases
  389. (modify-phases %standard-phases
  390. (replace 'build
  391. (lambda _
  392. (invoke "python" "setup.py" "config" "build"
  393. "--gencode" "--use_lapack")))
  394. (add-after 'unpack 'find-lapack-and-openblas
  395. (lambda* (#:key inputs #:allow-other-keys)
  396. (let ((lapack (assoc-ref inputs "lapack"))
  397. (blas (assoc-ref inputs "openblas")))
  398. (substitute* "cfg_packages.py"
  399. (("lapack_libs = .*'m']")
  400. "lapack_libs = ['lapack', 'openblas', 'm']\n")
  401. (("lapack_dirs = .*")
  402. (string-append "lapack_dirs = ['"
  403. lapack "/lib', '" blas "/lib']\n"))
  404. (("lapack_include_dirs = .*")
  405. (string-append "lapack_include_dirs = ['"
  406. lapack "/include', '" blas "/include']\n")))
  407. #t)))
  408. (add-after 'unpack 'change-directory
  409. (lambda _
  410. (chdir "thirdparty/numarray-1.5.2")
  411. (for-each make-file-writable (find-files "."))
  412. #t))
  413. (replace 'install
  414. (lambda* (#:key outputs #:allow-other-keys)
  415. (let ((out (assoc-ref outputs "out")))
  416. (invoke "python" "setup.py" "config"
  417. "install" "--use_lapack"
  418. (string-append "--prefix=" out))))))
  419. #:tests? #f)) ; no test target
  420. (inputs
  421. `(("lapack" ,lapack)
  422. ("openblas" ,openblas)))
  423. (home-page "")
  424. (synopsis "")
  425. (description "")
  426. (license license:bsd-3)))