summary refs log tree commit diff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-07 21:27:36 +0200
committerLudovic Courtès <ludo@gnu.org>2015-10-07 23:25:22 +0200
commit95288fcc6cfa184b500caa95062bf3194d255880 (patch)
treefd79c02f1c88a331b7a7678ae20bbf20185b2e8f /gnu/packages/python.scm
parent0d56e3e1bc7269c403c72ba265cec44d4757d1a1 (diff)
downloadguix-95288fcc6cfa184b500caa95062bf3194d255880.tar.gz
gnu: python: Add "minimal" variants.
* gnu/packages/python.scm (python2-minimal, python-minimal): New
  variables.
  (wrap-python3): New procedure.
  (python-wrapper): Use it.
  (python-minimal-wrapper): New variable.
* gnu/packages/xml.scm (libxslt)[native-inputs]: Use
  PYTHON-MINIMAL-WRAPPER instead of PYTHON-WRAPPER.
* gnu/packages/xorg.scm (xcb-proto, libxcb, xorg-server): Likewise.
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm43
1 files changed, 41 insertions, 2 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 08f5bca2c7..bb4b385026 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -260,9 +260,46 @@ data types.")
                                         (version-major+minor version)
                                         "/site-packages"))))))))
 
-(define-public python-wrapper
+;; Minimal variants of Python, mostly used to break the cycle between Tk and
+;; Python (Tk -> libxcb -> Python.)
+
+(define-public python2-minimal
+  (package (inherit python-2)
+    (name "python-minimal")
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-2)
+       ((#:configure-flags _)
+        `(list "--enable-shared"
+               (string-append "LDFLAGS=-Wl,-rpath="
+                              (assoc-ref %outputs "out") "/lib")))))
+    (inputs '())))                          ;none of the optional dependencies
+
+(define-public python-minimal
+  (package (inherit python)
+    (name "python-minimal")
+    (arguments
+     (substitute-keyword-arguments (package-arguments python)
+       ((#:configure-flags _)
+        `(let ((openssl (assoc-ref %build-inputs "openssl"))
+               (zlib    (assoc-ref %build-inputs "zlib"))
+               (out     (assoc-ref %outputs "out")))
+           (list "--enable-shared"
+                 (string-append "CPPFLAGS="
+                                "-I" openssl "/include "
+                                "-I" zlib "/include ")
+                 (string-append "LDFLAGS="
+                                "-L" openssl "/lib "
+                                "-L" zlib "/lib "
+                                "-Wl,-rpath=" out "/lib"))))))
+
+    ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
+    ;; zlib is required by 'zipimport', used by pip.
+    (inputs `(("openssl" ,openssl)
+              ("zlib" ,zlib)))))
+
+(define* (wrap-python3 python #:optional (name "python-wrapper"))
   (package (inherit python)
-    (name "python-wrapper")
+    (name name)
     (source #f)
     (build-system trivial-build-system)
     (propagated-inputs `(("python" ,python)))
@@ -286,6 +323,8 @@ data types.")
 that they can be invoked under their usual name---e.g., @command{python}
 instead of @command{python3}.")))
 
+(define-public python-wrapper (wrap-python3 python))
+(define-public python-minimal-wrapper (wrap-python3 python-minimal))
 
 (define-public python-psutil
   (package