(define-module (gn packages python24) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix utils) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system python) #:use-module (gn packages python) #:use-module (past packages python) #:use-module (gnu packages compression) #:use-module (gnu packages databases) #:use-module (gnu packages maths) #:use-module (gnu packages python-xyz) #:use-module (srfi srfi-1)) (define (default-python2.4) "Return the default Python-2.4 package." ;; Lazily resolve the binding. (let ((python (resolve-interface '(past packages python)))) (module-ref python 'python-2.4))) ;; We borrow this from (guix build-system python) since we cannot refer to it ;; with the magic '@@' symbol since Guix has switched to guile-3.0. (define* (package-with-explicit-python python old-prefix new-prefix #:key variant-property) "Return a procedure of one argument, P. The procedure creates a package with the same fields as P, which is assumed to use PYTHON-BUILD-SYSTEM, such that it is compiled with PYTHON instead. The inputs are changed recursively accordingly. If the name of P starts with OLD-PREFIX, this is replaced by NEW-PREFIX; otherwise, NEW-PREFIX is prepended to the name. When VARIANT-PROPERTY is present, it is used as a key to search for pre-defined variants of this transformation recorded in the 'properties' field of packages. The property value must be the promise of a package. This is a convenient way for package writers to force the transformation to use pre-defined variants." (define package-variant (if variant-property (lambda (package) (assq-ref (package-properties package) variant-property)) (const #f))) (define (transform p) (cond ;; If VARIANT-PROPERTY is present, use that. ((package-variant p) => force) ;; Otherwise build the new package object graph. ((eq? (package-build-system p) python-build-system) (package (inherit p) (location (package-location p)) (name (let ((name (package-name p))) (string-append new-prefix (if (string-prefix? old-prefix name) (substring name (string-length old-prefix)) name)))) (arguments (let ((python (if (promise? python) (force python) python))) (ensure-keyword-arguments (package-arguments p) `(#:python ,python)))))) (else p))) (define (cut? p) (or (not (eq? (package-build-system p) python-build-system)) (package-variant p))) (package-mapping transform cut?)) (define package-with-python24 (package-with-explicit-python (delay (default-python2.4)) "python-" "python24-" #:variant-property 'python24-variant)) (define (strip-python24-variant p) (package (inherit p) (properties (alist-delete 'python24-variant (package-properties p))))) (define-public python24-htmlgen (package (name "python24-htmlgen") (version "0.9") ;(version "0.99") (source (origin (method url-fetch) (uri (pypi-uri "htmlgen" version)) (sha256 (base32 "14xzjgwdqgs1vs5mq7mg3w48snvgb77yywv64mg8k6qhapmnafdw")))) ;"1kbn6jcbf2mpb9f8hm5gcsipy7habqrq4794lpdbzm5mqxlclmnl")))) (build-system python-build-system) (arguments `(#:python ,python-2.4)) (native-inputs `(("python24-setuptools" ,python24-setuptools))) (propagated-inputs `(("python24-asserts" ,python24-asserts))) (home-page "https://github.com/srittau/python-htmlgen") (synopsis "Python HTML 5 Generator") (description "Python-htmlgen is a library to generate HTML from classes.") (license license:expat))) (define-public python24-asserts (package (name "python24-asserts") (version "0.6") (source (origin (method url-fetch) (uri (pypi-uri "asserts" version)) (sha256 (base32 "05ffy111giwv6sqx97vzzsvcra0gxzx2ilv16gyw135v583frxbn")))) (build-system python-build-system) (arguments `(#:python ,python-2.4)) (native-inputs `(("python24-setuptools" ,python24-setuptools))) (home-page "https://github.com/srittau/python-asserts") (synopsis "Stand-alone Assertions for Python") (description "Stand-alone Assertions for Python") (license license:expat))) (define-public python24-pyx (package (name "python24-pyx") (version "0.12.1") (source (origin (method url-fetch) (uri (pypi-uri "pyx" version)) (sha256 (base32 "13kyhqx19rw7dlv2xapdb68j8l9laq6nrpgkyd6549qwidmb4dz8")))) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:use-setuptools? #f #:tests? #f)) ; tests not included (properties '((release-date "2012-10-26"))) (home-page "https://pyx-project.org/") (synopsis "Python package for the generation of PostScript, PDF, and SVG files") (description "Python package for the generation of PostScript, PDF, and SVG files.") (license license:gpl2+))) (define-public python24-pyxlwriter (package (name "python24-pyxlwriter") (version "0.4a3") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/pyxlwriter/pyxlwriter/" version "/pyXLWriter-" version ".zip")) (sha256 (base32 "1kfsi6la9y53rwayszgayfmkjfknpp650v69a0hwd1fcfk1df735")))) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:use-setuptools? #f #:tests? #f)) ; no tests (native-inputs `(("unzip" ,unzip))) (home-page "https://sourceforge.net/projects/pyxlwriter/") (synopsis "Python library for generating Excel compatible spreadsheets") (description "PyXLWriter is a Python library for generating Excel compatible spreadsheets. It's a port of John McNamara's Perl @code{Spreadsheet::WriteExcel} module version 1.01 to Python. It allows writing of Excel compatible spreadsheets without the need for COM objects.") (license license:lgpl2.1+))) (define-public python24-pil (package (inherit python2-pil1) (name "python24-pil") (arguments (substitute-keyword-arguments (package-arguments python2-pil1) ((#:python _) python-2.4))))) (define-public python24-piddle (package (inherit python2-piddle-gn) (name "python24-piddle") (arguments (substitute-keyword-arguments (package-arguments python2-piddle-gn) ((#:python _) python-2.4))) (native-inputs `(("python24-setuptools" ,python24-setuptools))) (propagated-inputs `(("python24-pil" ,python24-pil))))) ;; Apparently this is the library which mimics python-2.6+'s json library (define-public python24-simplejson (let ((base (package-with-python24 python-simplejson))) (package (inherit base) (version "2.0.9") ; last version to officially support python2.4 (source (origin (method url-fetch) (uri (pypi-uri "simplejson" version)) (sha256 (base32 "1vlkxibal9ljabybawnqr3jh6f6g21c5pbrzl65z9vwbfxhg9kdb")))) (native-inputs `(("python24-setuptools" ,python24-setuptools) ,@(package-native-inputs base)))))) (define-public python24-pp (package (name "python24-pp") (version "1.6.1") (source (origin (method url-fetch) (uri (string-append "http://www.parallelpython.com/downloads/pp/pp-" version ".zip")) (sha256 (base32 "0qkxcyclz3vgwpl6xvsrg76q59dj0wwy8qx15567bafv659ypyb1")))) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:use-setuptools? #f #:tests? #f)) ; no tests (native-inputs `(("unzip" ,unzip))) (home-page "http://www.parallelpython.com") (synopsis "Parallel and distributed programming for Python") (description "PP is a python module which provides mechanism for parallel execution of python code on SMP (systems with multiple processors or cores) and clusters (computers connected via network).") (license license:bsd-3))) (define GN1-thirdparty-sources (origin (method url-fetch/tarbomb) ;; ipfs get QmTPwYT2pehdxdG1TiHEzVzLgbeuhJ4utXShuz3twA84AB (uri "file:///gnu/store/p33a2sh3x2nhiiphdw9nly80njg6p8fi-thirdparty.tgz") (file-name "GN1-thirdparty") (sha256 (base32 "0nnp6g412hjfrcn3k2yrfb14sxv06k0149whc7qmv678nyj5zhfa")))) (define-public python24-json-GN1 (package (name "python24-json-GN1") (version "GN1") (source GN1-thirdparty-sources) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:phases (modify-phases %standard-phases (delete 'build) (delete 'check) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (sitedir (string-append out "/lib/python2.4/site-packages/json/"))) (mkdir-p sitedir) (copy-recursively "thirdparty/json" sitedir) #t)))))) (home-page "") (synopsis "") (description "") (license license:lgpl2.1+))) (define-public python24-svg-GN1 (package (name "python24-svg-GN1") (version "1.0") (source GN1-thirdparty-sources) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:phases (modify-phases %standard-phases (delete 'build) (delete 'check) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (sitedir (string-append out "/lib/python2.4/site-packages/svg/"))) (mkdir-p sitedir) (copy-recursively "thirdparty/svg" sitedir) #t)))))) (home-page "") (synopsis "") (description "") (license license:bsd-4))) (define-public python24-htmlgen-GN1 (package (name "python24-htmlgen-GN1") (version "2.5") (source GN1-thirdparty-sources) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:phases (modify-phases %standard-phases (delete 'build) (delete 'check) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (sitedir (string-append out "/lib/python2.4/site-packages/htmlgen/"))) (mkdir-p sitedir) (copy-recursively "thirdparty/htmlgen" sitedir) #t)))))) (home-page "") (synopsis "") (description "") (license license:bsd-2))) ; I'm not actually sure, checked HTMLgen.py (define-public python24-pyx-GN1 (package (name "python24-pyx-GN1") (version "0.8") (source GN1-thirdparty-sources) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:phases (modify-phases %standard-phases (delete 'build) (delete 'check) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (sitedir (string-append out "/lib/python2.4/site-packages/pyx/"))) (mkdir-p sitedir) (copy-recursively "thirdparty/pyx" sitedir) #t)))))) (home-page "") (synopsis "") (description "") (license license:gpl2+))) (define-public python24-pyxlwriter-GN1 (package (name "python24-pyxlwriter-GN1") (version "0.4a3") (source GN1-thirdparty-sources) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:phases (modify-phases %standard-phases (delete 'build) (delete 'check) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (sitedir (string-append out "/lib/python2.4/site-packages/pyXLWriter/"))) (mkdir-p sitedir) (copy-recursively "thirdparty/pyXLWriter" sitedir) #t)))))) (home-page "") (synopsis "") (description "") (license license:lgpl2.1+))) (define-public python24-pp-GN1 (package (name "python24-pp-GN1") (version "1.5.7") (source GN1-thirdparty-sources) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:use-setuptools? #f #:tests? #f #:phases (modify-phases %standard-phases (add-after 'unpack 'change-directory (lambda _ (chdir "thirdparty/pp-1.5.7") #t))))) (home-page "") (synopsis "") (description "") (license license:bsd-3))) (define-public python24-numarray-GN1 (package (name "python24-numarray-GN1") (version "1.5.2") (source GN1-thirdparty-sources) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:use-setuptools? #f #:phases (modify-phases %standard-phases (replace 'build (lambda _ (invoke "python" "setup.py" "config" "build" "--gencode" "--use_lapack"))) (add-after 'unpack 'find-lapack-and-openblas (lambda* (#:key inputs #:allow-other-keys) (let ((lapack (assoc-ref inputs "lapack")) (blas (assoc-ref inputs "openblas"))) (substitute* "cfg_packages.py" (("lapack_libs = .*'m']") "lapack_libs = ['lapack', 'openblas', 'm']\n") (("lapack_dirs = .*") (string-append "lapack_dirs = ['" lapack "/lib', '" blas "/lib']\n")) (("lapack_include_dirs = .*") (string-append "lapack_include_dirs = ['" lapack "/include', '" blas "/include']\n"))) #t))) (add-after 'unpack 'change-directory (lambda _ (chdir "thirdparty/numarray-1.5.2") (for-each make-file-writable (find-files ".")) #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (invoke "python" "setup.py" "config" "install" "--use_lapack" (string-append "--prefix=" out)))))) #:tests? #f)) ; no test target (inputs `(("lapack" ,lapack) ("openblas" ,openblas))) (home-page "") (synopsis "") (description "") (license license:bsd-3))) (define-public python24-mysqlclient (package (name "python24-mysqlclient") (version "1.2.5") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/PyMySQL/mysqlclient-python") (commit "MySQLdb-1.2.5"))) (file-name (git-file-name name version)) (sha256 (base32 "193h09afkmz9nw2jlwfdikx1xj9sybswd2705k8jy48h1ks6fnbj")))) (build-system python-build-system) (arguments `(#:python ,python-2.4 #:phases (modify-phases %standard-phases (add-after 'unpack 'dont-create-release-file (lambda _ (substitute* "setup_common.py" (("MySQLdb/release.py") (string-append (getcwd) "/release.py"))) #t)) (add-before 'check 'pre-check (lambda _ (call-with-output-file "/tmp/my.cnf" (lambda (p) (format p "[mysqld]~@ datadir=/tmp~@ socket=/tmp/mysql.sock~%"))) (system* "mysqld" "--defaults-file=/tmp/my.cnf" "--bootstrap") ;(invoke "mysql" "-S" "/tmp/mysql.sock" ; "-e" "'create database mysqldb_test charset utf8;'") #t))) #:tests? #f)) ; TODO: Run the test suite (native-inputs `(("mariadb" ,mariadb "dev") ("mariadb:bin" ,mariadb) ("python-nose" ,python24-nose) ("python-setuptools" ,python24-setuptools))) (inputs `(("zlib" ,zlib))) (home-page "http://mysql-python.sourceforge.net/") (synopsis "Python interface to MySQL") (description "MySQLdb is an interface to the popular MySQL database server for Python. The design goals are: @itemize @item with Python database API version 2.0 @item Thread-safety @item Thread-friendliness (threads will not block each other) @item Compatibility with MySQL-3.23 and later @end itemize") (license license:gpl2+)))