buildPython*: warn about deprecated argument stdenv

On Nixpkgs >= 26.05 (or precisely, oldest supported release >= 25.11),
warn about the use of buildPython*'s deprecated argument `stdenv`.

Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
This commit is contained in:
Yueh-Shun Li
2025-10-23 14:56:56 +08:00
co-authored by Matt Sturgeon
parent 3a4c37457b
commit e05528c65f
@@ -50,8 +50,10 @@ let
lib.setFunctionArgs (
args:
if !(lib.isFunction args) && (args ? stdenv) then
# TODO: warn that `args ? stdenv` is deprecated (once in-tree usage is migrated)
f.override { stdenv = args.stdenv; } args
lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2511) ''
Passing `stdenv` directly to `buildPythonPackage` or `buildPythonApplication` is deprecated. You should use their `.override` function instead, e.g:
buildPythonPackage.override { stdenv = customStdenv; } { }
'' (f.override { stdenv = args.stdenv; } args)
else
f args
) (removeAttrs (lib.functionArgs f) [ "stdenv" ])