gnu: python: Use G-Expressions.

* gnu/packages/python.scm (python-2.7)[arguments]: Use G-Expressions.
(python-3.10): Likewise, update accordingly.
(python-3.12): Likewise, update accordingly.
(python-debug): Likewise, update accordingly.

Change-Id: Iacb6f94fc6fb8ab70932321bc516a230c1c1003b
This commit is contained in:
Janneke Nieuwenhuizen 2024-12-31 20:05:35 +01:00 committed by Andreas Enge
parent 398d64f829
commit 83e3aa22a8
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3

View file

@ -56,7 +56,7 @@
;;; Copyright © 2018 Luther Thompson <lutheroto@gmail.com>
;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
;;; Copyright © 2019, 2024 Tanguy Le Carrour <tanguy@bioneland.org>
;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020, 2023, 2025 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com>
;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
;;; Copyright © 2022 jgart <jgart@dismail.de>
@ -180,9 +180,10 @@
"idle")) ;programming environment; weighs 5MB
(build-system gnu-build-system)
(arguments
`(#:test-target "test"
(list
#:test-target "test"
#:configure-flags
(list "--enable-shared" ;allow embedding
#~(list "--enable-shared" ;allow embedding
"--with-system-expat" ;for XML support
"--with-system-ffi" ;build ctypes
"--with-ensurepip=install" ;install pip and setuptools
@ -201,11 +202,11 @@
;; Disable runtime check failing if cross-compiling, see:
;; https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html
,@(if (%current-target-system)
'("ac_cv_buggy_getaddrinfo=no"
#$@(if (%current-target-system)
#~("ac_cv_buggy_getaddrinfo=no"
"ac_cv_file__dev_ptmx=no"
"ac_cv_file__dev_ptc=no")
'())
#~())
;; -fno-semantic-interposition reinstates some optimizations by gcc
;; leading to around 15% speedup. This is the default starting from
;; python 3.10.
@ -228,7 +229,7 @@
""))))
;; With no -j argument tests use all available cpus, so provide one.
#:make-flags
(list (string-append
#~(list (string-append
(format #f "TESTOPTS=-j~d" (parallel-job-count))
;; Exclude the following tests as they fail
;; non-deterministically with "error: [Errno 104] Connection
@ -237,19 +238,21 @@
;; https://github.com/python/cpython/commit/529525fb5a8fd9b96ab4021311a598c77588b918.
" --exclude test_urllib2_localnet test_httplib"))
#:modules ((ice-9 ftw) (ice-9 match)
(guix build utils) (guix build gnu-build-system))
#:modules '((ice-9 ftw)
(ice-9 match)
(guix build utils)
(guix build gnu-build-system))
#:phases
(modify-phases %standard-phases
#~(modify-phases %standard-phases
(add-before
'configure 'patch-lib-shells
(lambda _
;; This variable is used in setup.py to enable cross compilation
;; specific switches. As it is not set properly by configure
;; script, set it manually.
,@(if (%current-target-system)
'((setenv "_PYTHON_HOST_PLATFORM" ""))
'())
#$@(if (%current-target-system)
#~((setenv "_PYTHON_HOST_PLATFORM" ""))
#~())
;; Filter for existing files, since some may not exist in all
;; versions of python that are built with this recipe.
(substitute* (filter file-exists?
@ -259,13 +262,13 @@
"Lib/test/support/__init__.py"
"Lib/test/test_subprocess.py"))
(("/bin/sh") (which "sh")))))
,@(if (system-hurd?)
`((add-before 'build 'patch-regen-for-hurd
#$@(if (system-hurd?)
#~((add-before 'build 'patch-regen-for-hurd
(lambda* (#:key inputs #:allow-other-keys)
(let ((libc (assoc-ref inputs "libc")))
(substitute* "Lib/plat-generic/regen"
(("/usr/include/") (string-append libc "/include/")))))))
'())
#~())
(add-before 'configure 'do-not-record-configure-flags
(lambda* (#:key configure-flags #:allow-other-keys)
;; Remove configure flags from the installed '_sysconfigdata.py'
@ -391,9 +394,9 @@
(format #t "Compiling with optimization level: ~a\n"
(if (null? opt) "none" (car opt)))
(apply invoke
`(,,(if (%current-target-system)
`(,#$(if (%current-target-system)
"python2"
'(string-append out "/bin/python"))
#~(string-append out "/bin/python"))
,@opt
"-m" "compileall"
"-f" ; force rebuild
@ -407,7 +410,7 @@
(list '() '("-OO"))))
(map cdr outputs)))))
(add-after 'install 'install-sitecustomize.py
,(customize-site version)))))
#$(customize-site version)))))
(inputs
(list bzip2
expat
@ -481,14 +484,16 @@ data types.")
(arguments
(substitute-keyword-arguments (package-arguments python-2)
((#:configure-flags flags)
`(append ,flags '("--without-static-libpython")))
#~(append #$flags
;; XXX Use quote to avoid world rebuild at this time
'("--without-static-libpython")))
((#:make-flags _)
`(list (string-append
#~(list (string-append
(format #f "TESTOPTS=-j~d" (parallel-job-count))
;; test_mmap fails on low-memory systems
" --exclude test_mmap test_socket"
,@(if (system-hurd?)
'(" test_posix" ;multiple errors
#$@(if (system-hurd?)
#~(" test_posix" ;multiple errors
" test_time"
" test_pty"
" test_shutil"
@ -535,16 +540,16 @@ data types.")
" test_pdb "
" test_regrtest"
" test_sqlite")
'()))))
#~()))))
((#:phases phases)
`(modify-phases ,phases
,@(if (system-hurd?)
`((delete 'patch-regen-for-hurd) ;regen was removed after 3.5.9
#~(modify-phases #$phases
#$@(if (system-hurd?)
#~((delete 'patch-regen-for-hurd) ;regen was removed after 3.5.9
(add-after 'unpack 'disable-multi-processing
(lambda _
(substitute* "Makefile.pre.in"
(("-j0") "-j1")))))
'())
#~())
(add-after 'unpack 'remove-vendored-wheel-content
(lambda _
;; Delete .exe from embedded .whl (zip) files
@ -626,9 +631,9 @@ def contents() -> str:
(find-files output "\\.pyc$"))
(apply invoke
`(,,(if (%current-target-system)
`(,#$(if (%current-target-system)
"python3"
'(string-append out
#~(string-append out
"/bin/python3"))
"-m" "compileall"
"-o" "0" "-o" "1" "-o" "2"
@ -640,7 +645,7 @@ def contents() -> str:
,output)))
(map cdr outputs)))))
(replace 'install-sitecustomize.py
,(customize-site version))))))
#$(customize-site version))))))
(inputs
(modify-inputs (package-inputs python-2.7)
(replace "openssl" openssl)))
@ -1096,8 +1101,10 @@ def contents() -> str:
"idle")) ;programming environment; weighs 5MB
(build-system gnu-build-system)
(arguments
`(#:test-target "test"
#:configure-flags (list "--enable-shared" ;allow embedding
(list
#:test-target "test"
#:configure-flags
#~(list "--enable-shared" ;allow embedding
"--with-system-expat" ;for XML support
"--with-system-ffi" ;build ctypes
"--with-ensurepip=install" ;install pip and setuptools
@ -1118,11 +1125,11 @@ def contents() -> str:
;; Disable runtime check failing if cross-compiling, see:
;; https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html
,@(if (%current-target-system)
'("ac_cv_buggy_getaddrinfo=no"
#$@(if (%current-target-system)
#~("ac_cv_buggy_getaddrinfo=no"
"ac_cv_file__dev_ptmx=no"
"ac_cv_file__dev_ptc=no")
'())
#~())
;; -fno-semantic-interposition reinstates some
;; optimizations by gcc leading to around 15% speedup.
;; This is the default starting from python 3.10.
@ -1132,7 +1139,8 @@ def contents() -> str:
"/lib"
" -fno-semantic-interposition"))
;; With no -j argument tests use all available cpus, so provide one.
#:make-flags (list (string-append (format #f "TESTOPTS=-j~d"
#:make-flags
#~(list (string-append (format #f "TESTOPTS=-j~d"
(parallel-job-count))
;; those tests fail on low-memory systems
" --exclude"
@ -1141,8 +1149,8 @@ def contents() -> str:
" test_threading"
" test_asyncio"
" test_shutdown"
,@(if (system-hurd?)
'(" test_posix" ;multiple errors
#$@(if (system-hurd?)
#~(" test_posix" ;multiple errors
" test_time"
" test_pty"
" test_shutil"
@ -1187,30 +1195,31 @@ def contents() -> str:
" test_pdb "
" test_regrtest"
" test_sqlite")
'())))
#~())))
#:modules ((ice-9 ftw)
#:modules '((ice-9 ftw)
(ice-9 match)
(guix build utils)
(guix build gnu-build-system))
#:phases (modify-phases %standard-phases
,@(if (system-hurd?)
`((add-after 'unpack
#:phases
#~(modify-phases %standard-phases
#$@(if (system-hurd?)
#~((add-after 'unpack
'disable-multi-processing
(lambda _
(substitute* "Makefile.pre.in"
(("-j0")
"-j1")))))
'())
#~())
(add-before 'configure 'patch-lib-shells
(lambda _
;; This variable is used in setup.py to enable cross compilation
;; specific switches. As it is not set properly by configure
;; script, set it manually.
,@(if (%current-target-system)
'((setenv "_PYTHON_HOST_PLATFORM" ""))
'())
#$@(if (%current-target-system)
#~((setenv "_PYTHON_HOST_PLATFORM" ""))
#~())
;; Filter for existing files, since some may not exist in all
;; versions of python that are built with this recipe.
(substitute* (filter file-exists?
@ -1385,9 +1394,10 @@ def contents() -> str:
(find-files output "\\.pyc$"))
(apply invoke
`(,,(if (%current-target-system)
`(,#$(if (%current-target-system)
"python3"
'(string-append out
#~(string-append
out
"/bin/python3")) "-m"
"compileall"
"-o"
@ -1412,7 +1422,7 @@ def contents() -> str:
inputs) "tzdata")
"/share/zoneinfo"))))
(add-after 'install 'install-sitecustomize.py
,(customize-site version)))))
#$(customize-site version)))))
(inputs (list bzip2
expat
gdbm