summary refs log tree commit diff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm95
1 files changed, 56 insertions, 39 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index d15589ce97..fc4fad6f98 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -66,6 +66,7 @@
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages zip)
+  #:use-module (gnu packages tcl)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -86,7 +87,8 @@
                           version "/Python-" version ".tar.xz"))
       (sha256
        (base32
-        "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw"))))
+        "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw"))
+      (patches (list (search-patch "python-2.7-search-paths.patch")))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f
@@ -132,32 +134,10 @@
        ;; such file or directory
        #:test-target "test"
        #:configure-flags
-        (let ((bz2 (assoc-ref %build-inputs "bzip2"))
-              (gdbm (assoc-ref %build-inputs "gdbm"))
-              (libffi (assoc-ref %build-inputs "libffi"))
-              (sqlite (assoc-ref %build-inputs "sqlite"))
-              (openssl (assoc-ref %build-inputs "openssl"))
-              (readline (assoc-ref %build-inputs "readline"))
-              (zlib (assoc-ref %build-inputs "zlib"))
-              (out (assoc-ref %outputs "out")))
-         (list "--enable-shared"                  ; allow embedding
-               "--with-system-ffi"                ; build ctypes
-               (string-append "CPPFLAGS="
-                "-I" bz2 "/include "
-                "-I" gdbm "/include "
-                "-I" sqlite "/include "
-                "-I" openssl "/include "
-                "-I" readline "/include "
-                "-I" zlib "/include")
-               (string-append "LDFLAGS="
-                "-L" bz2 "/lib "
-                "-L" gdbm "/lib "
-                "-L" libffi "/lib "
-                "-L" sqlite "/lib "
-                "-L" openssl "/lib "
-                "-L" readline "/lib "
-                "-L" zlib "/lib "
-                "-Wl,-rpath=" out "/lib")))
+       (list "--enable-shared"                    ;allow embedding
+             "--with-system-ffi"                  ;build ctypes
+             (string-append "LDFLAGS=-Wl,-rpath="
+                            (assoc-ref %outputs "out") "/lib"))
 
         #:modules ((ice-9 ftw)
                    ,@%gnu-build-system-modules)
@@ -200,7 +180,9 @@
        ("sqlite" ,sqlite)                         ; for sqlite extension
        ("openssl" ,openssl)
        ("readline" ,readline)
-       ("zlib" ,zlib)))
+       ("zlib" ,zlib)
+       ("tcl" ,tcl)
+       ("tk" ,tk)))                               ; for tkinter
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (native-search-paths
@@ -208,8 +190,7 @@
             (variable "PYTHONPATH")
             (files '("lib/python2.7/site-packages")))))
     (home-page "http://python.org")
-    (synopsis
-     "High-level, dynamically-typed programming language")
+    (synopsis "High-level, dynamically-typed programming language")
     (description
      "Python is a remarkably powerful dynamic programming language that
 is used in a wide variety of application domains.  Some of its key
@@ -227,9 +208,11 @@ data types.")
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
                                   version "/Python-" version ".tar.xz"))
-              (patches (list (search-patch "python-fix-tests.patch")
-                             ;; XXX Try removing this patch for python > 3.4.3
-                             (search-patch "python-disable-ssl-test.patch")))
+              (patches (map search-patch
+                            '("python-fix-tests.patch"
+                              ;; XXX Try removing this patch for python > 3.4.3
+                              "python-disable-ssl-test.patch"
+                              "python-3-search-paths.patch")))
               (patch-flags '("-p0"))
               (sha256
                (base32
@@ -243,9 +226,38 @@ 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-wrapper")
+    (name "python-minimal")
+    (arguments
+     (substitute-keyword-arguments (package-arguments python)
+       ((#:configure-flags _)
+        `(list "--enable-shared"
+               (string-append "LDFLAGS=-Wl,-rpath="
+                              (assoc-ref %outputs "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 name)
     (source #f)
     (build-system trivial-build-system)
     (propagated-inputs `(("python" ,python)))
@@ -263,9 +275,14 @@ data types.")
                              (string-append bin "/" new)))
                   `("python3", "pydoc3", "idle3")
                   `("python",  "pydoc",  "idle"))))))
-    (description (string-append (package-description python)
-     "\n\nThis wrapper package provides symbolic links to the python binaries
-      without version suffix."))))
+    (synopsis "Wrapper for the Python 3 commands")
+    (description
+     "This package provides wrappers for the commands of Python@tie{}3.x such
+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
@@ -4015,7 +4032,7 @@ without using the configuration machinery.")
                    (man1 (string-append data "/man/man1"))
                    (info (string-append data "/info"))
                    (examples (string-append doc "/examples")))
-              (setenv "LANG" "en_US.UTF-8")
+              (setenv "LANG" "en_US.utf8")
               (with-directory-excursion "docs"
                 ;; FIXME: html and pdf fail to build
                 ;; (system* "make" "html")