summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki <fredmanglis@gmail.com>2017-07-18 11:37:09 +0300
committerRicardo Wurmus <rekado@elephly.net>2017-07-22 12:26:30 +0200
commit84fcb58050f4dc18cd3ec3ae13846789de5223b2 (patch)
tree4578eaabb282baa9c6f862fff5925d5c23fa398b /gnu/packages
parent4bc08b6e79e864ab2bfd21f387b669d7fda89880 (diff)
downloadguix-84fcb58050f4dc18cd3ec3ae13846789de5223b2.tar.gz
gnu: Add conda.
* gnu/packages/package-management.scm (conda): New variable.

Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/package-management.scm49
1 files changed, 49 insertions, 0 deletions
diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 1e46187988..d9ea6579e3 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -649,3 +649,52 @@ This package provides Conda as a library.")
 
 (define-public python2-conda
   (package-with-python2 python-conda))
+
+(define-public conda
+  (package (inherit python-conda)
+    (name "conda")
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-conda)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'build
+             (lambda* (#:key outputs #:allow-other-keys)
+               ;; This test fails when run before installation.
+               (delete-file "tests/test_activate.py")
+
+               ;; Fix broken defaults
+               (substitute* "conda/base/context.py"
+                 (("return sys.prefix")
+                  (string-append "return \"" (assoc-ref outputs "out") "\""))
+                 (("return (prefix_is_writable\\(self.root_prefix\\))" _ match)
+                  (string-append "return False if self.root_prefix == self.conda_prefix else "
+                                 match)))
+
+               ;; The util/setup-testing.py is used to build conda in
+               ;; application form, rather than the default, library form.
+               ;; With this, we are able to run commands like `conda --help`
+               ;; directly on the command line
+               (zero? (system* "python" "utils/setup-testing.py" "build_py"))))
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (target (string-append out "/lib/python"
+                                             ((@@ (guix build python-build-system)
+                                                  get-python-version)
+                                              (assoc-ref inputs "python"))
+                                             "/site-packages/")))
+                 ;; The installer aborts if the target directory is not on
+                 ;; PYTHONPATH.
+                 (setenv "PYTHONPATH"
+                         (string-append target ":" (getenv "PYTHONPATH")))
+
+                 ;; And it aborts if the directory doesn't exist.
+                 (mkdir-p target)
+                 (zero? (system* "python" "utils/setup-testing.py" "install"
+                                 (string-append "--prefix=" out))))))))))
+    (description
+     "Conda is a cross-platform, Python-agnostic binary package manager.  It
+is the package manager used by Anaconda installations, but it may be used for
+other systems as well.  Conda makes environments first-class citizens, making
+it easy to create independent environments even for C libraries.  Conda is
+written entirely in Python.")))