(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 copy) #:use-module (guix build-system python) #:use-module (gn packages python) #:use-module (gn past python) #:use-module (past packages python) #:use-module (gnu packages elf) #:use-module (gnu packages gcc) #:use-module (gnu packages python-xyz) ; #:use-module (gnu packages tls) #: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-pil (package (inherit python2-pil1) (name "python24-pil") (arguments (substitute-keyword-arguments (package-arguments python2-pil1) ((#:python _) python-2.4) ((#:phases phases '%standard-phases) `(modify-phases ,phases (replace 'add-install-to-pythonpath (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "PYTHONPATH" (string-append (site-packages inputs outputs) ":" (getenv "PYTHONPATH"))))) (delete 'sanity-check))))))) ; Not applicable to 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) ((#:phases phases '%standard-phases) `(modify-phases ,phases (replace 'add-install-to-pythonpath (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "PYTHONPATH" (string-append (site-packages inputs outputs) ":" (getenv "PYTHONPATH"))))) (delete 'sanity-check))))) ; Not applicable to 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-parallel (package (inherit python-parallel) (name "python24-parallel") (arguments `(#:python ,python-2.4 #:use-setuptools? #f #:tests? #f)))) ; no tests (define GN1-thirdparty-sources (origin (method url-fetch/tarbomb) (uri "https://files.genenetwork.org/software/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 'add-install-to-pythonpath (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "PYTHONPATH" (string-append (site-packages inputs outputs) ":" (getenv "PYTHONPATH"))))) (delete 'sanity-check) ; Not applicable to python-2.4 (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))))))) (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 'add-install-to-pythonpath (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "PYTHONPATH" (string-append (site-packages inputs outputs) ":" (getenv "PYTHONPATH"))))) (delete 'sanity-check) ; Not applicable to python-2.4 (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))))))) (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 'add-install-to-pythonpath (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "PYTHONPATH" (string-append (site-packages inputs outputs) ":" (getenv "PYTHONPATH"))))) (delete 'sanity-check) ; Not applicable to python-2.4 (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-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"))) (replace 'add-install-to-pythonpath (lambda* (#:key inputs outputs #:allow-other-keys) (setenv "PYTHONPATH" (string-append (site-packages inputs outputs) ":" (getenv "PYTHONPATH"))))) (delete 'sanity-check)))) ; Not applicable to python-2.4 (home-page "") (synopsis "") (description "") (license license:bsd-3))) (define-public python24-direct-gn (package (name "python24-direct-gn") (version "GN") (source (origin (method url-fetch) (uri "https://files.genenetwork.org/software/direct.so") (file-name "direct.so") (sha256 (base32 "0kj11dbi25k0wvyxxsylx7dsc7wm7rja799fymklkdd8h561la4i")))) (build-system copy-build-system) (arguments `(#:install-plan '(("direct.so" "lib/python2.4/site-packages/")) #:phases (modify-phases %standard-phases (replace 'unpack (lambda* (#:key inputs #:allow-other-keys) (copy-file (assoc-ref inputs "source") "direct.so") #t)) (add-after 'unpack 'patchelf (lambda* (#:key inputs #:allow-other-keys) ;; Writable so we can use patchelf, executable so it is useful. ;; After installation the writable bit is stripped off. (chmod "direct.so" #o777) (invoke "patchelf" "--set-rpath" (string-append (assoc-ref inputs "gcc:lib") "/lib") "direct.so") #t))))) (inputs `(("gcc:lib" ,gcc "lib"))) (native-inputs `(("patchelf" ,patchelf))) (home-page "") (synopsis "") (description "") (license #f)))