python3Packages.buildPythonPackage: add internal helper getFinalPassthru

Add getFinalPassthru, an internal helper function that
produces informative error message
when an atttribute is not found in `finalAttrs.passthru`.
This commit is contained in:
Yueh-Shun Li
2025-09-29 01:55:02 +08:00
parent ca40fe77e6
commit 0aebd262f1
@@ -204,6 +204,20 @@ let
self = stdenv.mkDerivation (
finalAttrs:
let
getFinalPassthru =
let
pos = unsafeGetAttrPos "passthru" finalAttrs;
in
attrName:
finalAttrs.passthru.${attrName} or (throw (
''
${finalAttrs.name}: passthru.${attrName} missing after overrideAttrs overriding.
''
+ optionalString (pos != null) ''
Last overridden at ${pos.file}:${toString pos.line}
''
));
format' =
assert (pyproject != null) -> (format == null);
if pyproject != null then