summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2021-03-17 13:33:22 +0100
committerJulien Lepiller <julien@lepiller.eu>2021-06-11 02:39:10 +0200
commit20d52562e5c943b30e48e310b58b94054c3a54e5 (patch)
tree09fdc39cf1ae0499bd15bbe2a4b909c33e46a462 /gnu/packages/python.scm
parenteda6a95d9d9a2c94d1390335731b0b5eb998bad3 (diff)
gnu: python: Remove unnecessary files.
* gnu/packages/python.scm (python2)[arguments]: Remove files built during the test phase. (python3)[arguments]: Also remove windows binaries shipped with the sources.
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm35
1 files changed, 33 insertions, 2 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index c8129ce46c8..9e29733091c 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -31,8 +31,8 @@
31;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org> 31;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
32;;; Copyright © 2016, 2017 Alex Vong <alexvong1995@gmail.com> 32;;; Copyright © 2016, 2017 Alex Vong <alexvong1995@gmail.com>
33;;; Copyright © 2016, 2017, 2018 Arun Isaac <arunisaac@systemreboot.net> 33;;; Copyright © 2016, 2017, 2018 Arun Isaac <arunisaac@systemreboot.net>
34;;; Copyright © 2016, 2017, 2018 Julien Lepiller <julien@lepiller.eu>
35;;; Copyright © 2016–2018, 2021 Tobias Geerinckx-Rice <me@tobias.gr> 34;;; Copyright © 2016–2018, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
35;;; Copyright © 2016, 2017, 2018, 2021 Julien Lepiller <julien@lepiller.eu>
36;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be> 36;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
37;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au> 37;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
38;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com> 38;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
@@ -295,7 +295,16 @@
295 (not 295 (not
296 (string-prefix? "test_support." 296 (string-prefix? "test_support."
297 file)))))) 297 file))))))
298 (call-with-output-file "__init__.py" (const #t))))))))) 298 (call-with-output-file "__init__.py" (const #t))))
299 (let ((libdir (string-append out "/lib/" pythonX.Y)))
300 (for-each
301 (lambda (directory)
302 (let ((dir (string-append libdir "/" directory)))
303 (when (file-exists? dir)
304 (delete-file-recursively dir))))
305 '("email/test" "ctypes/test" "unittest/test" "tkinter/test"
306 "sqlite3/test" "bsddb/test" "lib-tk/test" "lib2to3/tests"
307 "json/tests" "distutils/tests"))))))))
299 (add-after 'remove-tests 'rebuild-bytecode 308 (add-after 'remove-tests 'rebuild-bytecode
300 (lambda* (#:key outputs #:allow-other-keys) 309 (lambda* (#:key outputs #:allow-other-keys)
301 (let ((out (assoc-ref outputs "out"))) 310 (let ((out (assoc-ref outputs "out")))
@@ -416,6 +425,9 @@ data types.")
416 (substitute* "Modules/Setup" 425 (substitute* "Modules/Setup"
417 ;; Link Expat instead of embedding the bundled one. 426 ;; Link Expat instead of embedding the bundled one.
418 (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n")) 427 (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
428 ;; Delete windows binaries
429 (for-each delete-file
430 (find-files "Lib/distutils/command" "\\.exe$"))
419 #t)))) 431 #t))))
420 (arguments 432 (arguments
421 (substitute-keyword-arguments (package-arguments python-2) 433 (substitute-keyword-arguments (package-arguments python-2)
@@ -461,6 +473,23 @@ data types.")
461 ,@(if (hurd-system?) 473 ,@(if (hurd-system?)
462 `((delete 'patch-regen-for-hurd)) ;regen was removed after 3.5.9 474 `((delete 'patch-regen-for-hurd)) ;regen was removed after 3.5.9
463 '()) 475 '())
476 (add-after 'unpack 'remove-windows-binaries
477 (lambda _
478 ;; Delete .exe from embedded .whl (zip) files
479 (for-each
480 (lambda (whl)
481 (let ((dir "whl-content"))
482 (mkdir-p dir)
483 (with-directory-excursion dir
484 (let ((whl (string-append "../" whl)))
485 (invoke "unzip" whl)
486 (for-each delete-file
487 (find-files "." "\\.exe$"))
488 (delete-file whl)
489 (apply invoke "zip" "-X" whl
490 (find-files "." ".*" #:directories? #t))))
491 (delete-file-recursively dir)))
492 (find-files "Lib/ensurepip" "\\.whl$"))))
464 (add-before 'check 'set-TZDIR 493 (add-before 'check 'set-TZDIR
465 (lambda* (#:key inputs native-inputs #:allow-other-keys) 494 (lambda* (#:key inputs native-inputs #:allow-other-keys)
466 ;; test_email requires the Olson time zone database. 495 ;; test_email requires the Olson time zone database.
@@ -495,6 +524,8 @@ data types.")
495 ,(customize-site version)))))) 524 ,(customize-site version))))))
496 (native-inputs 525 (native-inputs
497 `(("tzdata" ,tzdata-for-tests) 526 `(("tzdata" ,tzdata-for-tests)
527 ("unzip" ,unzip)
528 ("zip" ,(@ (gnu packages compression) zip))
498 ,@(if (%current-target-system) 529 ,@(if (%current-target-system)
499 `(("python3" ,this-package)) 530 `(("python3" ,this-package))
500 '()) 531 '())