From da484bd577ff428865ac9acdb97784c7acdf4355 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Fri, 26 Dec 2025 04:08:37 +0100 Subject: [PATCH] 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 Signed-off-by: Rutherther --- 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 f87719c7f2d82ca298c73827cee8d66dd1ce592e..d6fe695a645a7f184a9d69f746cf4d707ad41bd2 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