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`.
This commit is contained in:
@@ -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
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user