guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

09/09: gnu: python: Move tkinter to "tk" output.


From: Ludovic Courtès
Subject: 09/09: gnu: python: Move tkinter to "tk" output.
Date: Sat, 21 Nov 2015 09:58:55 +0000

civodul pushed a commit to branch tk-update
in repository guix.

commit d7572b42de323238c709c25f36d60c6b4f69d1f0
Author: Ludovic Courtès <address@hidden>
Date:   Sun Nov 15 22:27:45 2015 +0100

    gnu: python: Move tkinter to "tk" output.
    
    * gnu/packages/python.scm (python-2)[outputs]: New field.
      [arguments]: Add 'move-tk-inter' phase.
      [native-search-paths]: Add "lib/python2.7/lib-dynload".
    * gnu/packages/python.scm (python)[native-search-paths]: Likewise.
    * gnu/packages/python.scm (python2-minimal, python-minimal,
      wrap-python3)[outputs]: New field.
---
 gnu/packages/python.scm |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index d1e7c3b..649d6b0 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -95,6 +95,8 @@
                     '("python-2.7-search-paths.patch"
                       "python-2-deterministic-build-info.patch"
                       "python-2.7-source-date-epoch.patch")))))
+    (outputs '("out"
+               "tk"))                     ;tkinter; adds 50 MiB to the closure
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f
@@ -199,7 +201,23 @@
                (ftw "." (lambda (file stat flag)
                           (utime file circa-1980 circa-1980)
                           #t))
-               #t))))))
+               #t)))
+          (add-after 'install 'move-tk-inter
+            (lambda* (#:key outputs #:allow-other-keys)
+              ;; When Tkinter support is built move it to a separate output so
+              ;; that the main output doesn't contain a reference to Tcl/Tk.
+              (let ((out (assoc-ref outputs "out"))
+                    (tk  (assoc-ref outputs "tk")))
+                (when tk
+                  (match (find-files out "tkinter.*\\.so")
+                    ((tkinter.so)
+                     (let* ((len    (string-length out))
+                            (target (string-append
+                                     tk "/" (string-drop (dirname tkinter.so)
+                                                         len))))
+                       (install-file tkinter.so target)
+                       (delete-file tkinter.so)))))
+                #t))))))
     (inputs
      `(("bzip2" ,bzip2)
        ("gdbm" ,gdbm)
@@ -215,7 +233,8 @@
     (native-search-paths
      (list (search-path-specification
             (variable "PYTHONPATH")
-            (files '("lib/python2.7/site-packages")))))
+            (files '("lib/python2.7/site-packages"
+                     "lib/python2.7/lib-dynload")))))
     (home-page "http://python.org";)
     (synopsis "High-level, dynamically-typed programming language")
     (description
@@ -252,7 +271,10 @@ data types.")
             (variable "PYTHONPATH")
             (files (list (string-append "lib/python"
                                         (version-major+minor version)
-                                        "/site-packages"))))))))
+                                        "/site-packages")
+                         (string-append "lib/python"
+                                        (version-major+minor version)
+                                        "/lib-dynload"))))))))
 
 ;; Minimal variants of Python, mostly used to break the cycle between Tk and
 ;; Python (Tk -> libxcb -> Python.)
@@ -260,6 +282,7 @@ data types.")
 (define-public python2-minimal
   (package (inherit python-2)
     (name "python-minimal")
+    (outputs '("out"))
     (arguments
      (substitute-keyword-arguments (package-arguments python-2)
        ((#:configure-flags cf)
@@ -269,6 +292,7 @@ data types.")
 (define-public python-minimal
   (package (inherit python)
     (name "python-minimal")
+    (outputs '("out"))
     (arguments
      (substitute-keyword-arguments (package-arguments python)
        ((#:configure-flags cf)
@@ -284,6 +308,7 @@ data types.")
     (name name)
     (source #f)
     (build-system trivial-build-system)
+    (outputs '("out"))
     (propagated-inputs `(("python" ,python)))
     (arguments
      `(#:modules ((guix build utils))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]