summaryrefslogtreecommitdiff
path: root/tw/packages/python.scm
blob: be8271b82179809475be80fd12315ac8a3d5fcb1 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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))))))))))))