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.

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