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.

437 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-asserts
  98. (package
  99. (name "python24-asserts")
  100. (version "0.6")
  101. (source
  102. (origin
  103. (method url-fetch)
  104. (uri (pypi-uri "asserts" version))
  105. (sha256
  106. (base32
  107. "05ffy111giwv6sqx97vzzsvcra0gxzx2ilv16gyw135v583frxbn"))))
  108. (build-system python-build-system)
  109. (arguments
  110. `(#:python ,python-2.4))
  111. (native-inputs
  112. `(("python24-setuptools" ,python24-setuptools)))
  113. (home-page "https://github.com/srittau/python-asserts")
  114. (synopsis "Stand-alone Assertions for Python")
  115. (description "Stand-alone Assertions for Python")
  116. (license license:expat)))
  117. (define-public python24-pyx
  118. (package
  119. (name "python24-pyx")
  120. (version "0.12.1")
  121. (source
  122. (origin
  123. (method url-fetch)
  124. (uri (pypi-uri "pyx" version))
  125. (sha256
  126. (base32
  127. "13kyhqx19rw7dlv2xapdb68j8l9laq6nrpgkyd6549qwidmb4dz8"))))
  128. (build-system python-build-system)
  129. (arguments
  130. `(#:python ,python-2.4))
  131. (native-inputs
  132. `(("python24-setuptools" ,python24-setuptools)))
  133. (home-page "http://pyx.sourceforge.net/")
  134. (synopsis "Python package for the generation of PostScript, PDF, and SVG files")
  135. (description "Python package for the generation of PostScript, PDF, and SVG files")
  136. (license license:gpl2+)))
  137. (define-public python24-pyxlwriter
  138. (package
  139. (name "python24-pyxlwriter")
  140. (version "0.4a3")
  141. (source
  142. (origin
  143. (method url-fetch)
  144. (uri (string-append "mirror://sourceforge/pyxlwriter/pyxlwriter/"
  145. version "/pyXLWriter-" version ".zip"))
  146. (sha256
  147. (base32
  148. "1kfsi6la9y53rwayszgayfmkjfknpp650v69a0hwd1fcfk1df735"))))
  149. (build-system python-build-system)
  150. (arguments
  151. `(#:python ,python-2.4
  152. #:use-setuptools? #f
  153. #:tests? #f)) ; no tests
  154. (native-inputs
  155. `(("unzip" ,unzip)))
  156. (home-page "https://sourceforge.net/projects/pyxlwriter/")
  157. (synopsis "Python library for generating Excel compatible spreadsheets")
  158. (description "PyXLWriter is a Python library for generating Excel compatible
  159. spreadsheets. It's a port of John McNamara's Perl @code{Spreadsheet::WriteExcel}
  160. module version 1.01 to Python. It allows writing of Excel compatible
  161. spreadsheets without the need for COM objects.")
  162. (license license:lgpl2.1+)))
  163. (define-public python24-pil
  164. (package
  165. (inherit python2-pil1)
  166. (name "python24-pil")
  167. (arguments
  168. (substitute-keyword-arguments (package-arguments python2-pil1)
  169. ((#:python _) python-2.4)))))
  170. (define-public python24-piddle
  171. (package
  172. (inherit python2-piddle-gn)
  173. (name "python24-piddle")
  174. (arguments
  175. (substitute-keyword-arguments (package-arguments python2-piddle-gn)
  176. ((#:python _) python-2.4)))
  177. (native-inputs `(("python24-setuptools" ,python24-setuptools)))
  178. (propagated-inputs
  179. `(("python24-pil" ,python24-pil)))))
  180. ;; Apparently this is the library which mimics python-2.6+'s json library
  181. (define-public python24-simplejson
  182. (let ((base (package-with-python24 python-simplejson)))
  183. (package
  184. (inherit base)
  185. (version "2.0.9") ; last version to officially support python2.4
  186. (source
  187. (origin
  188. (method url-fetch)
  189. (uri (pypi-uri "simplejson" version))
  190. (sha256
  191. (base32
  192. "1vlkxibal9ljabybawnqr3jh6f6g21c5pbrzl65z9vwbfxhg9kdb"))))
  193. (native-inputs
  194. `(("python24-setuptools" ,python24-setuptools)
  195. ,@(package-native-inputs base))))))
  196. (define-public python24-pp
  197. (package
  198. (name "python24-pp")
  199. (version "1.6.1")
  200. (source
  201. (origin
  202. (method url-fetch)
  203. (uri (string-append
  204. "http://www.parallelpython.com/downloads/pp/pp-" version ".zip"))
  205. (sha256
  206. (base32
  207. "0qkxcyclz3vgwpl6xvsrg76q59dj0wwy8qx15567bafv659ypyb1"))))
  208. (build-system python-build-system)
  209. (arguments
  210. `(#:python ,python-2.4
  211. #:use-setuptools? #f
  212. #:tests? #f)) ; no tests
  213. (native-inputs
  214. `(("unzip" ,unzip)))
  215. (home-page "http://www.parallelpython.com")
  216. (synopsis "Parallel and distributed programming for Python")
  217. (description "PP is a python module which provides mechanism for parallel
  218. execution of python code on SMP (systems with multiple processors or cores) and
  219. clusters (computers connected via network).")
  220. (license license:bsd-3)))
  221. (define GN1-thirdparty-sources
  222. (origin
  223. (method url-fetch/tarbomb)
  224. ;; ipfs get QmTPwYT2pehdxdG1TiHEzVzLgbeuhJ4utXShuz3twA84AB
  225. (uri "file:///gnu/store/p33a2sh3x2nhiiphdw9nly80njg6p8fi-thirdparty.tgz")
  226. (file-name "GN1-thirdparty")
  227. (sha256
  228. (base32
  229. "0nnp6g412hjfrcn3k2yrfb14sxv06k0149whc7qmv678nyj5zhfa"))))
  230. (define-public python24-json-GN1
  231. (package
  232. (name "python24-json-GN1")
  233. (version "GN1")
  234. (source GN1-thirdparty-sources)
  235. (build-system python-build-system)
  236. (arguments
  237. `(#:python ,python-2.4
  238. #:phases
  239. (modify-phases %standard-phases
  240. (delete 'build)
  241. (delete 'check)
  242. (replace 'install
  243. (lambda* (#:key outputs #:allow-other-keys)
  244. (let* ((out (assoc-ref outputs "out"))
  245. (sitedir (string-append out "/lib/python2.4/site-packages/json/")))
  246. (mkdir-p sitedir)
  247. (copy-recursively "thirdparty/json" sitedir)
  248. #t))))))
  249. (home-page "")
  250. (synopsis "")
  251. (description "")
  252. (license license:lgpl2.1+)))
  253. (define-public python24-svg-GN1
  254. (package
  255. (name "python24-svg-GN1")
  256. (version "1.0")
  257. (source GN1-thirdparty-sources)
  258. (build-system python-build-system)
  259. (arguments
  260. `(#:python ,python-2.4
  261. #:phases
  262. (modify-phases %standard-phases
  263. (delete 'build)
  264. (delete 'check)
  265. (replace 'install
  266. (lambda* (#:key outputs #:allow-other-keys)
  267. (let* ((out (assoc-ref outputs "out"))
  268. (sitedir (string-append out "/lib/python2.4/site-packages/svg/")))
  269. (mkdir-p sitedir)
  270. (copy-recursively "thirdparty/svg" sitedir)
  271. #t))))))
  272. (home-page "")
  273. (synopsis "")
  274. (description "")
  275. (license license:bsd-4)))
  276. (define-public python24-htmlgen-GN1
  277. (package
  278. (name "python24-htmlgen-GN1")
  279. (version "2.5")
  280. (source GN1-thirdparty-sources)
  281. (build-system python-build-system)
  282. (arguments
  283. `(#:python ,python-2.4
  284. #:phases
  285. (modify-phases %standard-phases
  286. (delete 'build)
  287. (delete 'check)
  288. (replace 'install
  289. (lambda* (#:key outputs #:allow-other-keys)
  290. (let* ((out (assoc-ref outputs "out"))
  291. (sitedir (string-append out "/lib/python2.4/site-packages/htmlgen/")))
  292. (mkdir-p sitedir)
  293. (copy-recursively "thirdparty/htmlgen" sitedir)
  294. #t))))))
  295. (home-page "")
  296. (synopsis "")
  297. (description "")
  298. (license license:bsd-2))) ; I'm not actually sure, checked HTMLgen.py
  299. (define-public python24-pyx-GN1
  300. (package
  301. (name "python24-pyx-GN1")
  302. (version "0.8")
  303. (source GN1-thirdparty-sources)
  304. (build-system python-build-system)
  305. (arguments
  306. `(#:python ,python-2.4
  307. #:phases
  308. (modify-phases %standard-phases
  309. (delete 'build)
  310. (delete 'check)
  311. (replace 'install
  312. (lambda* (#:key outputs #:allow-other-keys)
  313. (let* ((out (assoc-ref outputs "out"))
  314. (sitedir (string-append out "/lib/python2.4/site-packages/pyx/")))
  315. (mkdir-p sitedir)
  316. (copy-recursively "thirdparty/pyx" sitedir)
  317. #t))))))
  318. (home-page "")
  319. (synopsis "")
  320. (description "")
  321. (license license:gpl2+)))
  322. (define-public python24-pyxlwriter-GN1
  323. (package
  324. (name "python24-pyxlwriter-GN1")
  325. (version "0.4a3")
  326. (source GN1-thirdparty-sources)
  327. (build-system python-build-system)
  328. (arguments
  329. `(#:python ,python-2.4
  330. #:phases
  331. (modify-phases %standard-phases
  332. (delete 'build)
  333. (delete 'check)
  334. (replace 'install
  335. (lambda* (#:key outputs #:allow-other-keys)
  336. (let* ((out (assoc-ref outputs "out"))
  337. (sitedir (string-append out "/lib/python2.4/site-packages/pyXLWriter/")))
  338. (mkdir-p sitedir)
  339. (copy-recursively "thirdparty/pyXLWriter" sitedir)
  340. #t))))))
  341. (home-page "")
  342. (synopsis "")
  343. (description "")
  344. (license license:lgpl2.1+)))
  345. (define-public python24-pp-GN1
  346. (package
  347. (name "python24-pp-GN1")
  348. (version "1.5.7")
  349. (source GN1-thirdparty-sources)
  350. (build-system python-build-system)
  351. (arguments
  352. `(#:python ,python-2.4
  353. #:use-setuptools? #f
  354. #:tests? #f
  355. #:phases
  356. (modify-phases %standard-phases
  357. (add-after 'unpack 'change-directory
  358. (lambda _
  359. (chdir "thirdparty/pp-1.5.7") #t)))))
  360. (home-page "")
  361. (synopsis "")
  362. (description "")
  363. (license license:bsd-3)))
  364. (define-public python24-numarray-GN1
  365. (package
  366. (name "python24-numarray-GN1")
  367. (version "1.5.2")
  368. (source GN1-thirdparty-sources)
  369. (build-system python-build-system)
  370. (arguments
  371. `(#:python ,python-2.4
  372. #:use-setuptools? #f
  373. #:phases
  374. (modify-phases %standard-phases
  375. (replace 'build
  376. (lambda _
  377. (invoke "python" "setup.py" "config" "build"
  378. "--gencode" "--use_lapack")))
  379. (add-after 'unpack 'find-lapack-and-openblas
  380. (lambda* (#:key inputs #:allow-other-keys)
  381. (let ((lapack (assoc-ref inputs "lapack"))
  382. (blas (assoc-ref inputs "openblas")))
  383. (substitute* "cfg_packages.py"
  384. (("lapack_libs = .*'m']")
  385. "lapack_libs = ['lapack', 'openblas', 'm']\n")
  386. (("lapack_dirs = .*")
  387. (string-append "lapack_dirs = ['"
  388. lapack "/lib', '" blas "/lib']\n"))
  389. (("lapack_include_dirs = .*")
  390. (string-append "lapack_include_dirs = ['"
  391. lapack "/include', '" blas "/include']\n")))
  392. #t)))
  393. (add-after 'unpack 'change-directory
  394. (lambda _
  395. (chdir "thirdparty/numarray-1.5.2")
  396. (for-each make-file-writable (find-files "."))
  397. #t))
  398. (replace 'install
  399. (lambda* (#:key outputs #:allow-other-keys)
  400. (let ((out (assoc-ref outputs "out")))
  401. (invoke "python" "setup.py" "config"
  402. "install" "--use_lapack"
  403. (string-append "--prefix=" out))))))
  404. #:tests? #f)) ; no test target
  405. (inputs
  406. `(("lapack" ,lapack)
  407. ("openblas" ,openblas)))
  408. (home-page "")
  409. (synopsis "")
  410. (description "")
  411. (license license:bsd-3)))