From 5dc59002fdc3c6cd8bce6103f31ea88e906a3e1e Mon Sep 17 00:00:00 2001 From: Sam <30577766+Samasaur1@users.noreply.github.com> Date: Sun, 12 Apr 2026 14:04:21 -0700 Subject: [PATCH] python312Packages.mobi: exclude standard-imghdr to fix build Our `standard-*` packages are set up to be null on the Python versions that still include the corresponding module in the standard library. However, since mobi depends on standard-imghdr unconditionally, using the package on versions of Python that still have imghdr in the standard library fails to build due to the following sequence of steps: 1. Something calls `python312Packages.mobi`. 2. `standard-imghdr` in the dependencies resolves to `null`, since `imghdr` is still in the standard library on Python 3.12 and we have the `standard-imghdr` package set to be null on versions of Python where `imghdr` is in the standard library. 3. `pythonRuntimeDepsCheck` runs. 4. `pythonRuntimeDepsCheck` sees `Requires-Dist: standard-imghdr` in mobi's distinfo metadata and checks whether the package is installed. 5. It is not, so the runtime deps check fails the build. We solve this issue by removing `standard-imghdr` from the list of dependencies on versions of Python where the package is set to `null` (those versions that have `imghdr` in the standard library). The package continues to work because it will transparently import the standard library version of `imghdr`. --- pkgs/development/python-modules/mobi/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/python-modules/mobi/default.nix b/pkgs/development/python-modules/mobi/default.nix index c5e5d1e898c4..4b747b433131 100644 --- a/pkgs/development/python-modules/mobi/default.nix +++ b/pkgs/development/python-modules/mobi/default.nix @@ -6,6 +6,7 @@ hatchling, standard-imghdr, pytestCheckHook, + pythonOlder, }: buildPythonPackage rec { @@ -29,6 +30,8 @@ buildPythonPackage rec { standard-imghdr ]; + pythonRemoveDeps = lib.optionals (pythonOlder "3.13") [ "standard-imghdr" ]; + nativeCheckInputs = [ pytestCheckHook ];