query
On this page

buildPythonPackage

pkgs.python3Packages.buildPythonPackage

Functor
Docs pulled from | This Revision | 18 days ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

origArgs:
      let
        result = f origArgs;
        overrideWith =
          # Preserve the plain arguments whenever possible,
          # as `overrideStdenvCompat` works more reliably with `args.stdenv`
          # than `result.__stdenvPythonCompat`.
          # TODO(@ShamrockLee): After `overrideStdenvCompat` is fully deprecated,
          # simplify as
          # ```nix
          # newArgs: lib.extends (lib.toExtension newArgs) origArgs
          # ```
          if lib.isFunction origArgs then
            newArgs: lib.extends (lib.toExtension newArgs) origArgs
          else
            newArgs:
            if !(lib.isFunction newArgs) then
              origArgs // newArgs
            else if !(lib.isFunction (newArgs origArgs)) then
              origArgs // newArgs origArgs
            else
              finalAttrs: origArgs // newArgs finalAttrs origArgs;
      in
      if lib.isAttrs result then
        result
        // {
          overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
          overrideAttrs =
            newArgs: makeOverridablePythonPackage (args: (f args).overrideAttrs newArgs) origArgs;
        }
      else
        result