about summary refs log tree commit diff
path: root/gn/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gn/packages')
-rw-r--r--gn/packages/genenetwork.scm1
-rw-r--r--gn/packages/python24.scm122
2 files changed, 123 insertions, 0 deletions
diff --git a/gn/packages/genenetwork.scm b/gn/packages/genenetwork.scm
index 0db7032..b60bd60 100644
--- a/gn/packages/genenetwork.scm
+++ b/gn/packages/genenetwork.scm
@@ -713,6 +713,7 @@ written in C")
       (propagated-inputs
        `(("python" ,python-2.4)
          ("httpd-with-mod-python" ,httpd22-with-mod-python)
+	 ("python-direct" ,python24-direct-gn)
          ("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..4a26e1f 100644
--- a/gn/packages/python24.scm
+++ b/gn/packages/python24.scm
@@ -4,12 +4,18 @@
   #: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 databases)
   #:use-module (gn packages python)
   #:use-module (past packages python)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages databases)
+<<<<<<< HEAD
+=======
+  #:use-module (gnu packages elf)
+  #:use-module (gnu packages gcc)
+>>>>>>> 0684b02... gn: Use known good binary version of direct.so for genenetwork1
   #:use-module (gnu packages maths)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages tls)
@@ -385,3 +391,119 @@ for Python.  The design goals are:
 @item Compatibility with MySQL-3.23 and later
 @end itemize")
     (license license:gpl2+)))
+
+;; It seems this isn't the correct DIRECT binary
+(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)))
+
+; env IPFS_PATH=/export/ipfs/ ipfs add direct.so
+; added QmYUZiuAP6DJeubu69JqvRWSsn53qCZCS3FkRWgTowtWkA direct.so
+; penguin2:~/tmp$ env IPFS_PATH=/export/ipfs/ ipfs pin add QmYUZiuAP6DJeubu69JqvRWSsn53qCZCS3FkRWgTowtWkA
+; pinned QmYUZiuAP6DJeubu69JqvRWSsn53qCZCS3FkRWgTowtWkA recursively
+
+(define-public python24-direct-gn
+  (package
+    (name "python24-direct-gn")
+    (version "GN")
+    (source (origin
+              (method url-fetch)
+              (uri "http://ipfs.genenetwork.org/ipfs/QmYUZiuAP6DJeubu69JqvRWSsn53qCZCS3FkRWgTowtWkA")
+              (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)))