From 8a8ea5700baa3f56a2edbdd08ebd013631a31e15 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Thu, 19 Jan 2023 23:22:03 +0100 Subject: Add almost-working Python 3.11 package --- tw/packages/python.scm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tw/packages/python.scm (limited to 'tw/packages') diff --git a/tw/packages/python.scm b/tw/packages/python.scm new file mode 100644 index 00000000..be8271b8 --- /dev/null +++ b/tw/packages/python.scm @@ -0,0 +1,48 @@ +(define-module (tw packages python) + #:use-module (gnu packages) + #:use-module (gnu packages python) + #:use-module (guix packages) + #:use-module (guix utils)) + +(define-public python-3.11 + (package + (inherit python-3.9) + (version "3.11.1") + (source + (origin + (inherit (package-source python-3.9)) + (uri (string-append "https://www.python.org/ftp/python/" + version "/Python-" version ".tar.xz")) + (patches (search-patches + ;; "python-3-arm-alignment.patch" ; merged upstream + ;; "python-3-no-static-lib.patch" ; Makefile has changed significantly, this doesn't apply cleanly any more + "python-3.11-fix-tests.patch" ; patched patch for 3.11 + "python-3-deterministic-build-info.patch" ; from python-3.9 + "python-3-hurd-configure.patch" ; from python-3.9 + "python-3-search-paths.patch")) ; from python-3.9 + (sha256 (base32 "13xmvw0pjqr96mr69xxpjkiybwzb95cr14n02v5mdzfgya9931w5")))) + (arguments + (substitute-keyword-arguments (package-arguments python-3.9) + ((#:configure-flags flags) + `(cons* + ;; FIXME: These flags make Python significantly faster, but make + ;; binaries non-reproducible. + "--with-lto" ; increase size by 20MB, but 15% speedup + "--enable-optimizations" + ,flags)) + ((#:phases phases) + `(modify-phases ,phases + ;; Fix the "test_tools" test. This relies on `bash' or `bash-minimal' being an input. + (add-before 'configure 'patch-default-shell + (lambda* (#:key inputs configure-flags #:allow-other-keys) + (use-modules (ice-9 format)) + (let ((/bin/sh (string-append (assoc-ref inputs "bash") "/bin/sh"))) + ;; Patch ./configure to set the right CONFIG_SHELL fallback, not /bin/sh. + (substitute* "configure" + (("-/bin/sh") ; the "-" prevents us from patching the shebang + (string-append "-" /bin/sh)) + (("^CONFIG_ARGS=.*$") ; the freeze test uses CONFIG_ARGS + (format #f "CONFIG_ARGS='~{\"~a\" ~}'" configure-flags))) + (substitute* "Makefile.pre.in" + (("^SHELL=[[:space:]]*/bin/sh$") + (string-append "SHELL=" /bin/sh)))))))))))) -- cgit v1.2.3