diff options
| author | Julien Lepiller <julien@lepiller.eu> | 2021-06-03 22:14:14 +0200 |
|---|---|---|
| committer | Julien Lepiller <julien@lepiller.eu> | 2021-06-11 02:39:54 +0200 |
| commit | e4aa346d57f61956626032d0d1dfca6b3c96e06a (patch) | |
| tree | 0107bd12f52f54cd4421603a4d6387623bb36945 /gnu/packages/python.scm | |
| parent | 8ce96d84470912cadb6ecb03002236c52234dd9b (diff) | |
gnu: python: Move idle to a separate output.
idle is a programming environment that is not useful for building
packages, but it is still useful for end users. This saves 5MB in the
default output.
* gnu/packages/python.scm (python-2.7)[outputs]: Add `idle'.
[arguments]: Move idle files in the new output.
(wrap-python): Do not wrap idle since it is in a different output.
Diffstat (limited to 'gnu/packages/python.scm')
| -rw-r--r-- | gnu/packages/python.scm | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index e55794a48f1..227c612a68c 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm | |||
| @@ -176,7 +176,8 @@ | |||
| 176 | "Lib/test/test_subprocess.py")) | 176 | "Lib/test/test_subprocess.py")) |
| 177 | #t)))) | 177 | #t)))) |
| 178 | (outputs '("out" | 178 | (outputs '("out" |
| 179 | "tk")) ;tkinter; adds 50 MiB to the closure | 179 | "tk" ;tkinter; adds 50 MiB to the closure |
| 180 | "idle")) ;programming environment; weighs 5MB | ||
| 180 | (build-system gnu-build-system) | 181 | (build-system gnu-build-system) |
| 181 | (arguments | 182 | (arguments |
| 182 | `(#:test-target "test" | 183 | `(#:test-target "test" |
| @@ -360,6 +361,27 @@ | |||
| 360 | (install-file tkinter.so target) | 361 | (install-file tkinter.so target) |
| 361 | (delete-file tkinter.so))))) | 362 | (delete-file tkinter.so))))) |
| 362 | #t))) | 363 | #t))) |
| 364 | (add-after 'install 'move-idle | ||
| 365 | (lambda* (#:key outputs #:allow-other-keys) | ||
| 366 | ;; when idle is built, move it to a separate output to save some | ||
| 367 | ;; space (5MB) | ||
| 368 | (let ((out (assoc-ref outputs "out")) | ||
| 369 | (idle (assoc-ref outputs "idle"))) | ||
| 370 | (when idle | ||
| 371 | (for-each | ||
| 372 | (lambda (file) | ||
| 373 | (let ((target (string-append idle "/bin/" (basename file)))) | ||
| 374 | (install-file file (dirname target)) | ||
| 375 | (delete-file file))) | ||
| 376 | (find-files (string-append out "/bin") "^idle")) | ||
| 377 | (match (find-files out "^idlelib$" #:directories? #t) | ||
| 378 | ((idlelib) | ||
| 379 | (let* ((len (string-length out)) | ||
| 380 | (target (string-append idle "/" | ||
| 381 | (string-drop idlelib len) | ||
| 382 | "/site-packages"))) | ||
| 383 | (mkdir-p (dirname target)) | ||
| 384 | (rename-file idlelib target)))))))) | ||
| 363 | (add-after 'install 'install-sitecustomize.py | 385 | (add-after 'install 'install-sitecustomize.py |
| 364 | ,(customize-site version))))) | 386 | ,(customize-site version))))) |
| 365 | (inputs | 387 | (inputs |
| @@ -623,8 +645,8 @@ for more information."))) | |||
| 623 | (lambda (old new) | 645 | (lambda (old new) |
| 624 | (symlink (string-append python old) | 646 | (symlink (string-append python old) |
| 625 | (string-append bin "/" new))) | 647 | (string-append bin "/" new))) |
| 626 | `("python3" ,"pydoc3" ,"idle3" ,"pip3") | 648 | `("python3" ,"pydoc3" ,"pip3") |
| 627 | `("python" ,"pydoc" ,"idle" ,"pip")) | 649 | `("python" ,"pydoc" ,"pip")) |
| 628 | ;; python-config outputs search paths based upon its location, | 650 | ;; python-config outputs search paths based upon its location, |
| 629 | ;; use a bash wrapper to avoid changing its outputs. | 651 | ;; use a bash wrapper to avoid changing its outputs. |
| 630 | (let ((bash (string-append (assoc-ref %build-inputs "bash") | 652 | (let ((bash (string-append (assoc-ref %build-inputs "bash") |
