From 3e4b64a501f421b30ed8e6dbc5a6af7d5f62bbd6 Mon Sep 17 00:00:00 2001 From: EarthenGarland <> Date: Wed, 24 Sep 2025 11:38:22 +0300 Subject: [PATCH] python3Packages.cffi: 1.17.1 -> 2.0.0 --- .../python-modules/cffi/default.nix | 91 +++++++------------ pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 32 insertions(+), 61 deletions(-) diff --git a/pkgs/development/python-modules/cffi/default.nix b/pkgs/development/python-modules/cffi/default.nix index b7a5c901435a..0c837d51ffce 100644 --- a/pkgs/development/python-modules/cffi/default.nix +++ b/pkgs/development/python-modules/cffi/default.nix @@ -1,75 +1,46 @@ { - lib, - stdenv, buildPythonPackage, - isPyPy, - fetchPypi, - setuptools, - pytestCheckHook, + fetchFromGitHub, + lib, libffi, pkg-config, pycparser, + pytestCheckHook, + setuptools, + stdenv, }: -let - version = "1.17.1"; -in -if isPyPy then - buildPythonPackage { - pname = "cffi"; - inherit version; - pyproject = false; +buildPythonPackage rec { + pname = "cffi"; + version = "2.0.0"; + pyproject = true; - # cffi is bundled with PyPy. - dontUnpack = true; + src = fetchFromGitHub { + owner = "python-cffi"; + repo = "cffi"; + tag = "v${version}"; + hash = "sha256-7Mzz3KmmmE2xQru1GA4aY0DZqn6vxykWiExQvnA1bjM="; + }; - # Some dependent packages expect to have pycparser available when using cffi. - dependencies = [ pycparser ]; + nativeBuildInputs = [ pkg-config ]; - meta = { - description = "Foreign Function Interface for Python calling C code (bundled with PyPy, placeholder package)"; - homepage = "https://cffi.readthedocs.org/"; - license = lib.licenses.mit; - teams = [ lib.teams.python ]; - }; - } -else - buildPythonPackage rec { - pname = "cffi"; - inherit version; - pyproject = true; + build-system = [ setuptools ]; - src = fetchPypi { - inherit pname version; - hash = "sha256-HDnGAWwyvEjdVFYZUOvWg24WcPKuRhKPZ89J54nFKCQ="; - }; + buildInputs = [ libffi ]; - nativeBuildInputs = [ pkg-config ]; + # Some dependent packages expect to have pycparser available when using cffi. + dependencies = [ pycparser ]; - build-system = [ setuptools ]; + doCheck = !(stdenv.hostPlatform.isMusl || stdenv.hostPlatform.useLLVM or false); - buildInputs = [ libffi ]; + nativeCheckInputs = [ pytestCheckHook ]; - dependencies = [ pycparser ]; - - # The tests use -Werror but with python3.6 clang detects some unreachable code. - env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument -Wno-unreachable-code -Wno-c++11-narrowing"; - - doCheck = !(stdenv.hostPlatform.isMusl || stdenv.hostPlatform.useLLVM or false); - - nativeCheckInputs = [ pytestCheckHook ]; - - disabledTests = lib.optionals stdenv.hostPlatform.isFreeBSD [ - # https://github.com/python-cffi/cffi/pull/144 - "test_dlopen_handle" - ]; - - meta = with lib; { - changelog = "https://github.com/python-cffi/cffi/releases/tag/v${version}"; - description = "Foreign Function Interface for Python calling C code"; - downloadPage = "https://github.com/python-cffi/cffi"; - homepage = "https://cffi.readthedocs.org/"; - license = licenses.mit; - teams = [ teams.python ]; - }; - } + meta = { + changelog = "https://github.com/python-cffi/cffi/releases/tag/v${version}"; + description = "Foreign Function Interface for Python calling C code"; + downloadPage = "https://github.com/python-cffi/cffi"; + homepage = "https://cffi.readthedocs.org/"; + license = lib.licenses.mit0; + teams = [ lib.teams.python ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index db7b4e220692..c03ec4824a11 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2474,7 +2474,7 @@ self: super: with self; { cffconvert = callPackage ../development/python-modules/cffconvert { }; - cffi = callPackage ../development/python-modules/cffi { }; + cffi = if isPyPy then null else callPackage ../development/python-modules/cffi { }; cffsubr = callPackage ../development/python-modules/cffsubr { };