summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2024-05-16 13:56:17 +0200
committerLudovic Courtès <ludo@gnu.org>2024-08-31 10:45:03 +0200
commitfae667797949aba4e8e2b4a813b7035ba947f6f9 (patch)
tree47cf38f01a8e931567ae0305b7c2138fd99a348a
parent49c35eec114c20500d0d5eb6cc2e121f3bbd18eb (diff)
downloadguix-fae667797949aba4e8e2b4a813b7035ba947f6f9.tar.gz
gnu: python-3.10: Ungraft removing bundled cacert.pem.
* gnu/packages/python.scm (python-3.10): Rename phase
"remove-windows-binaries" to "remove-vendored-wheel-content", and use it to
also remove "cacert.pem".  Ungraft.
(python-3.10/fixed): Remove variable.

Change-Id: I0a1a5c7f597ef6e14ea165ccded9aa473c6d9122
-rw-r--r--gnu/packages/python.scm112
1 files changed, 35 insertions, 77 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4deca6769d..c5f98c3a46 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -453,7 +453,6 @@ data types.")
     (inherit python-2)
     (name "python")
     (version "3.10.7")
-    (replacement python-3.10/fixed)
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
@@ -546,7 +545,7 @@ data types.")
                        (substitute* "Makefile.pre.in"
                          (("-j0") "-j1")))))
                  '())
-           (add-after 'unpack 'remove-windows-binaries
+           (add-after 'unpack 'remove-vendored-wheel-content
              (lambda _
                ;; Delete .exe from embedded .whl (zip) files
                (for-each
@@ -560,6 +559,40 @@ data types.")
                         (for-each delete-file
                                   (find-files "." "\\.exe$"))
                         (delete-file whl)
+
+                        ;; Search for cacert.pem, delete it, and rewrite the
+                        ;; file which directs python to look for it.
+                        (let ((cacert (find-files "." "cacert\\.pem")))
+                          (unless (null? cacert)
+                            (let ((certifi (dirname (car cacert))))
+                              (delete-file (string-append certifi "/cacert.pem"))
+                              (delete-file (string-append certifi "/core.py"))
+                              (with-output-to-file (string-append certifi "/core.py")
+                                (lambda _
+                                  (display "\"\"\"
+certifi.py
+~~~~~~~~~~
+This file is a Guix-specific version of core.py.
+
+This module returns the installation location of SSL_CERT_FILE or
+/etc/ssl/certs/ca-certificates.crt, or its contents.
+\"\"\"
+import os
+
+_CA_CERTS = None
+
+try:
+    _CA_CERTS = os.environ [\"SSL_CERT_FILE\"]
+except:
+    _CA_CERTS = os.path.join(\"/etc\", \"ssl\", \"certs\", \"ca-certificates.crt\")
+
+def where() -> str:
+    return _CA_CERTS
+
+def contents() -> str:
+    with open(where(), \"r\", encoding=\"ascii\") as data:
+        return data.read()"))))))
+
                         ;; Reset timestamps to prevent them from ending
                         ;; up in the Zip archive.
                         (ftw "." (lambda (file stat flag)
@@ -1014,81 +1047,6 @@ data types.")
     (properties '((cpe-name . "python")))
     (license license:psfl)))
 
-(define python-3.10/fixed
-  (package
-    (inherit python-3.10)
-    (arguments
-     (substitute-keyword-arguments (package-arguments python-3.10)
-       ((#:phases phases)
-        #~(modify-phases #$phases
-            ;; Also remove the bundled CA certificates.
-            ;; TODO: Rename this phase when merging back into python.
-            (replace 'remove-windows-binaries
-              (lambda _
-                ;; Delete .exe from embedded .whl (zip) files
-                (for-each
-                 (lambda (whl)
-                   (let ((dir "whl-content")
-                         (circa-1980 (* 10 366 24 60 60)))
-                     (mkdir-p dir)
-                     (with-directory-excursion dir
-                       (let ((whl (string-append "../" whl)))
-                         (invoke "unzip" whl)
-                         (for-each delete-file
-                                   (find-files "." "\\.exe$"))
-                         (delete-file whl)
-
-                         ;; Search for cacert.pem, delete it, and rewrite the
-                         ;; file which directs python to look for it.
-                         (let ((cacert (find-files "." "cacert\\.pem")))
-                           (unless (null? cacert)
-                             (let ((certifi (dirname (car cacert))))
-                               (delete-file (string-append certifi "/cacert.pem"))
-                               (delete-file (string-append certifi "/core.py"))
-                               (with-output-to-file (string-append certifi "/core.py")
-                                 (lambda _
-                                   (display "\"\"\"
-certifi.py
-~~~~~~~~~~
-This file is a Guix-specific version of core.py.
-
-This module returns the installation location of SSL_CERT_FILE or
-/etc/ssl/certs/ca-certificates.crt, or its contents.
-\"\"\"
-import os
-
-_CA_CERTS = None
-
-try:
-    _CA_CERTS = os.environ [\"SSL_CERT_FILE\"]
-except:
-    _CA_CERTS = os.path.join(\"/etc\", \"ssl\", \"certs\", \"ca-certificates.crt\")
-
-def where() -> str:
-    return _CA_CERTS
-
-def contents() -> str:
-    with open(where(), \"r\", encoding=\"ascii\") as data:
-        return data.read()"))))))
-
-                         ;; Reset timestamps to prevent them from ending
-                         ;; up in the Zip archive.
-                         (ftw "." (lambda (file stat flag)
-                                    (utime file circa-1980 circa-1980)
-                                    #t))
-                         (apply invoke "zip" "-X" whl
-                                (find-files "." #:directories? #t))))
-                     (delete-file-recursively dir)))
-                 (find-files "Lib/ensurepip" "\\.whl$"))))))))
-    (native-search-paths
-     (list (guix-pythonpath-search-path (package-version python-3.10))
-           $SSL_CERT_FILE
-           ;; Used to locate tzdata by the zoneinfo module introduced in
-           ;; Python 3.9.
-           (search-path-specification
-            (variable "PYTHONTZPATH")
-            (files (list "share/zoneinfo")))))))
-
 ;; Next 3.x version.
 (define-public python-next python-3.12)