From ac3535858a2447a92b024835415060947be83252 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 11 Jul 2021 13:52:30 +0300 Subject: gn: Add python24-direct. * gn/packages/python24.scm (python24-direct): New variable. * gn/packages/genenetwork.scm (genenetwork1)[propagated-inputs]: Add python24-direct. --- gn/packages/genenetwork.scm | 1 + gn/packages/python24.scm | 71 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/gn/packages/genenetwork.scm b/gn/packages/genenetwork.scm index 3891f50..35f628e 100644 --- a/gn/packages/genenetwork.scm +++ b/gn/packages/genenetwork.scm @@ -758,6 +758,7 @@ written in C") (propagated-inputs `(("python" ,python-2.4) ("httpd-with-mod-python" ,httpd22-with-mod-python) + ("python-direct" ,python24-direct) ("python-htmlgen-GN1" ,python24-htmlgen-GN1) ("python-json-GN1" ,python24-json-GN1) ("python-mysqlclient" ,python24-mysqlclient) diff --git a/gn/packages/python24.scm b/gn/packages/python24.scm index cde8a02..b4de823 100644 --- a/gn/packages/python24.scm +++ b/gn/packages/python24.scm @@ -10,6 +10,7 @@ #:use-module (past packages python) #:use-module (gnu packages compression) #:use-module (gnu packages databases) + #:use-module (gnu packages gcc) #:use-module (gnu packages maths) #:use-module (gnu packages python-xyz) #:use-module (gnu packages tls) @@ -385,3 +386,73 @@ for Python. The design goals are: @item Compatibility with MySQL-3.23 and later @end itemize") (license license:gpl2+))) + +(define-public python24-direct + (package + (name "python24-direct") + (version "1.0.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "DIRECT" version)) + (sha256 + (base32 + "1d4cf9hynlr42hq0k8w7j4qi45rkrgil332sh0hymklxgmyi21h5")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Files are autogenerated using f2py. + (delete-file "src/direct-f2pywrappers.f") + (delete-file "src/directmodule.c") + #t)))) + (build-system python-build-system) + (arguments + `(#:python ,python-2.4 + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-source + (lambda _ + (substitute* "DIRECT/__init__.py" + (("\\.direct") "direct")) + #t)) + (replace 'check + (lambda* (#:key tests? inputs outputs #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + (with-directory-excursion "test" + (invoke "python" "test_direct.py"))) + #t)) + (add-after 'install 'copy-library + (lambda* (#:key outputs #:allow-other-keys) + (with-directory-excursion + (string-append (assoc-ref outputs "out") + "/lib/python2.4/site-packages") + (copy-file "DIRECT/direct.so" "direct.so")) + #t)) + (replace 'install-license-files + (lambda* (#:key outputs #:allow-other-keys) + (install-file "COPYRIGHT" + (string-append (assoc-ref outputs "out") + "/share/doc/" ,name "-" ,version)) + #t))))) + (propagated-inputs + `(("python24-numpy" ,python24-numpy-1.2))) + (inputs + `(("gfortran" ,gfortran))) + (native-inputs + `(("python24-nose" ,python24-nose) + ("python24-setuptools" ,python24-setuptools))) + ;; Also seems to be here: https://github.com/amitibo/pydirect + (home-page "http://code.google.com/p/pydirect/") + (synopsis "Python wrapper to the DIRECT algorithm") + (description + "DIRECT is a method to solve global bound constraint optimization problems +and was originally developed by D. R. Jones, C. D. Perttunen and B. E. Stuckmann. +@code{pydirect} is a python wrapper around DIRECT. It enables using DIRECT from +the comfort of the great Python scripting language. +The @code{pydirect} package uses the fortan implementation of DIRECT written by +Joerg.M.Gablonsky, DIRECT Version 2.0.4. More information on the DIRECT +algorithm can be found in Gablonsky's +@url{http://repository.lib.ncsu.edu/ir/bitstream/1840.16/3920/1/etd.pdf, +thesis}.") + (license license:expat))) -- cgit v1.2.3