mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-20 15:41:16 +00:00
Merge staging-next into staging
This commit is contained in:
@@ -420,6 +420,7 @@ lib.extendMkDerivation {
|
||||
optional-dependencies
|
||||
;
|
||||
updateScript = nix-update-script { };
|
||||
${if attrs ? stdenv then "__stdenvPythonCompat" else null} = attrs.stdenv;
|
||||
}
|
||||
// attrs.passthru or { };
|
||||
|
||||
|
||||
@@ -53,15 +53,28 @@ let
|
||||
f':
|
||||
lib.mirrorFunctionArgs f (
|
||||
args:
|
||||
if !(lib.isFunction args) && (args ? stdenv) then
|
||||
lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2511) ''
|
||||
${
|
||||
args.name or args.pname or "<unnamed>"
|
||||
}: Passing `stdenv` directly to `buildPythonPackage` or `buildPythonApplication` is deprecated. You should use their `.override` function instead, e.g:
|
||||
buildPythonPackage.override { stdenv = customStdenv; } { }
|
||||
'' (f'.override { inherit (args) stdenv; } (removeAttrs args [ "stdenv" ]))
|
||||
let
|
||||
result = f args;
|
||||
getName = x: x.pname or (lib.getName (x.name or "<unnamed>"));
|
||||
applyMsgStdenvArg =
|
||||
name:
|
||||
lib.warnIf (lib.oldestSupportedReleaseIsAtLeast 2511) ''
|
||||
${name}: Passing `stdenv` directly to `buildPythonPackage` or `buildPythonApplication` is deprecated. You should use their `.override` function instead, e.g:
|
||||
buildPythonPackage.override { stdenv = customStdenv; } { }
|
||||
'';
|
||||
in
|
||||
if lib.isFunction args && result ? __stdenvPythonCompat then
|
||||
# Less reliable, as constructing with the wrong `stdenv` might lead to evaluation errors in the package definition.
|
||||
f'.override { stdenv = applyMsgStdenvArg (getName result) result.__stdenvPythonCompat; } (
|
||||
finalAttrs: removeAttrs (args finalAttrs) [ "stdenv" ]
|
||||
)
|
||||
else if (!lib.isFunction args) && (args ? stdenv) then
|
||||
# More reliable, but only works when args is not `(finalAttrs: { })`
|
||||
f'.override { stdenv = applyMsgStdenvArg (getName args) args.stdenv; } (
|
||||
removeAttrs args [ "stdenv" ]
|
||||
)
|
||||
else
|
||||
f args
|
||||
result
|
||||
)
|
||||
// {
|
||||
# Preserve the effect of overrideStdenvCompat when calling `buildPython*.override`.
|
||||
|
||||
Reference in New Issue
Block a user