guix_mirror_bot pushed a commit to branch next-master
in repository guix.

commit 8b5107248dda312917eed1c858fd6ff883a6e8c0
Author: Nicolas Graves <[email protected]>
AuthorDate: Fri Dec 26 04:08:37 2025 +0100

    gnu: python2-cffi: Migrate to pyproject and decouple.
    
    Rationale: Decoupling helps us moving the package, and not worry about
    inheriting package updates.
    
    * gnu/packages/python-xyz.scm (python2-cffi)
    [inherit]: Drop it.
    [source]: Decrease version to 1.15.1, which is the last supported
    version for Python2. The former build fails with 1.17.0.
    [build-system, arguments]: Migrate to pyproject-build-system.
    [name, home-page, synopsis, description, license]: Set them
    explicitely.
    
    Change-Id: Iea81e4fd3896da044a97043e2d80f5f43b28f50e
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/libffi.scm | 48 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 35 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/libffi.scm b/gnu/packages/libffi.scm
index f87719c7f2..d6fe695a64 100644
--- a/gnu/packages/libffi.scm
+++ b/gnu/packages/libffi.scm
@@ -45,9 +45,7 @@
   #:use-module (gnu packages sphinx)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system pyproject)
-  #:use-module ((guix build-system python) #:select (pypi-uri
-                                                     package-with-python2
-                                                     python-build-system))
+  #:use-module ((guix build-system python) #:select (pypi-uri))
   #:use-module (guix build-system ruby))
 
 (define-public libffi
@@ -172,20 +170,44 @@ conversions for values passed between the two languages.")
 ;;; This Python 2 dependency is needed by the Pypy build system, which is
 ;;; unlikely to change in the future.
 (define-public python2-cffi
-  (let ((base (package/inherit python-cffi
-                ;; FIXME: package-with-python2 needs to be updated to accept
-                ;; pyproject-build-system package.
-                (build-system python-build-system)
+  (let ((base (package
+                (name "python-cffi")
+                (version "1.15.1")
+                (source
+                 (origin
+                   (method url-fetch)
+                   (uri (pypi-uri "cffi" version))
+                   (sha256
+                    (base32 
"1y9lr651svbzf1m03s4lqbnbv2byx8f6f0ml7hjm24vvlfwvy06l"))))
+                (build-system pyproject-build-system)
                 (arguments
-                 (cons* #:tests? #f
-                        (strip-keyword-arguments
-                         '(#:test-flags)
-                         (package-arguments python-cffi))))
+                 (list
+                  #:tests? #f
+                  #:phases
+                  #~(modify-phases %standard-phases
+                      (replace 'build
+                        (lambda _
+                          (invoke "python" "setup.py" "build")))
+                      (replace 'install
+                        (lambda _
+                          (let ((site (string-append #$output
+                                                     
"/lib/python2.7/site-packages/")))
+                            (mkdir-p site)
+                            (setenv "PYTHONPATH" site))
+                          (invoke "python" "./setup.py" "install"
+                                  (string-append "--prefix=" #$output)
+                                  "--no-compile"))))))
                 (native-inputs '())
                 (inputs (modify-inputs (package-inputs python-cffi)
                           (append libxcrypt)))
-                (propagated-inputs (list python2-pycparser)))))
-    (package-with-python2 base)))
+                (propagated-inputs (list python2-pycparser))
+                (home-page "https://cffi.readthedocs.io/";)
+                (synopsis "Foreign function interface for Python")
+                (description "Foreign Function Interface for Python calling C 
code.")
+                (license expat))))
+    (package
+      (inherit (package-with-python2 base))
+      (native-inputs (list pkg-config python-setuptools)))))
 
 (define-public python-cffi-documentation
   (package

Reply via email to