Skip to content

Commit

Permalink
buildPython*: make attributes overridable via overrideAttrs (non-stag…
Browse files Browse the repository at this point in the history
…ing)

Make src, removePythonDeps and relaxPythonDeps overridable
via overrideAttrs for Python packages.

Make pyproject overridable via overrideAttrs as passthru.pyproject.
  • Loading branch information
ShamrockLee committed Jan 25, 2025
1 parent 969fed9 commit 6dd94cd
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions pkgs/development/interpreters/python/mk-python-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ let
finalAttrs:
let
format' =
assert (pyproject != null) -> (format == null);
if pyproject != null then
if pyproject then "pyproject" else "other"
assert (finalAttrs.passthru.pyproject != null) -> (format == null);
if finalAttrs.passthru.pyproject != null then
if finalAttrs.passthru.pyproject then "pyproject" else "other"
else if format != null then
format
else
Expand Down Expand Up @@ -268,11 +268,11 @@ let
in
attrName: inputs: map (checkDrv attrName) inputs;

isBootstrapInstallPackage = isBootstrapInstallPackage' (attrs.pname or null);
isBootstrapInstallPackage = isBootstrapInstallPackage' (finalAttrs.pname or null);

isBootstrapPackage = isBootstrapInstallPackage || isBootstrapPackage' (attrs.pname or null);
isBootstrapPackage = isBootstrapInstallPackage || isBootstrapPackage' (finalAttrs.pname or null);

isSetuptoolsDependency = isSetuptoolsDependency' (attrs.pname or null);
isSetuptoolsDependency = isSetuptoolsDependency' (finalAttrs.pname or null);

in
(cleanAttrs attrs)
Expand All @@ -298,13 +298,15 @@ let
#
pythonCatchConflictsHook
]
++ optionals (attrs ? pythonRelaxDeps || attrs ? pythonRemoveDeps) [
pythonRelaxDepsHook
]
++
optionals (finalAttrs.pythonRelaxDeps or [ ] != [ ] || finalAttrs.pythonRemoveDeps or [ ] != [ ])
[
pythonRelaxDepsHook
]
++ optionals removeBinBytecode [
pythonRemoveBinBytecodeHook
]
++ optionals (hasSuffix "zip" (attrs.src.name or "")) [
++ optionals (hasSuffix "zip" (finalAttrs.src.name or "")) [
unzip
]
++ optionals (format' == "setuptools") [
Expand Down Expand Up @@ -399,7 +401,10 @@ let

passthru =
{
inherit disabled;
inherit
disabled
pyproject
;
}
// {
updateScript =
Expand Down

0 comments on commit 6dd94cd

Please sign in to comment.