Commit d608fbb9 authored by Alyssa Ross's avatar Alyssa Ross Committed by Frederik Rietdijk
Browse files

buildPython*: allow overriding disabled packages

Previously:

	nix-repl> python3.pkgs.WSME
	error: WSME-0.11.0 not supported for interpreter python3.10

	nix-repl> python3.pkgs.WSME.overridePythonAttrs (_: { disabled = false; })
	error: WSME-0.11.0 not supported for interpreter python3.10

Now:

	nix-repl> python3.pkgs.WSME
	error: WSME-0.11.0 not supported for interpreter python3.10
	«derivation

	nix-repl> python3.pkgs.WSME.overridePythonAttrs (_: { disabled = false; })
	«derivation /nix/store/cxkiwdfm146zvl573s2hahlbjd1wfrrp-python3.10-WSME-0.11.0.drv»
parent 6d5025d6
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -101,12 +101,6 @@

, ... } @ attrs:


# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
if disabled
then throw "${name} not supported for interpreter ${python.executable}"
else

let
  inherit (python) stdenv;

@@ -114,6 +108,7 @@ let

  name_ = name;

  # Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
  self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [
    "disabled" "checkPhase" "checkInputs" "nativeCheckInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "format"
    "disabledTestPaths" "outputs"
@@ -204,4 +199,7 @@ let
  passthru.updateScript = let
      filename = builtins.head (lib.splitString ":" self.meta.position);
    in attrs.passthru.updateScript or [ update-python-libraries filename ];
in lib.extendDerivation true passthru self
in lib.extendDerivation
  (disabled -> throw "${name} not supported for interpreter ${python.executable}")
  passthru
  self