overrides: Remove condition from wheel override

This commit is contained in:
adisbladis 2020-08-17 03:34:58 +02:00
parent f4ab52a42c
commit b6f9670d56
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
4 changed files with 57 additions and 10 deletions

View file

@ -114,7 +114,7 @@ lib.makeScope pkgs.newScope (self: {
__toPluginAble = toPluginAble self; __toPluginAble = toPluginAble self;
inherit (hooks) pipBuildHook removePathDependenciesHook poetry2nixFixupHook; inherit (hooks) pipBuildHook removePathDependenciesHook poetry2nixFixupHook wheelUnpackHook;
} }
) )
# Null out any filtered packages, we don't want python.pkgs from nixpkgs # Null out any filtered packages, we don't want python.pkgs from nixpkgs

View file

@ -49,4 +49,16 @@ in
} ./fixup-hook.sh } ./fixup-hook.sh
) { }; ) { };
# When the "wheel" package itself is a wheel the nixpkgs hook (which pulls in "wheel") leads to infinite recursion
# It doesn't _really_ depend on wheel though, it just copies the wheel.
wheelUnpackHook = callPackage
({}:
makeSetupHook
{
name = "wheel-unpack-hook.sh";
deps = [ ];
} ./wheel-unpack-hook.sh
) { };
} }

View file

@ -0,0 +1,18 @@
# Setup hook to use in case a wheel is fetched
echo "Sourcing wheel setup hook"
wheelUnpackPhase(){
echo "Executing wheelUnpackPhase"
runHook preUnpack
mkdir -p dist
cp "$src" "dist/$(stripHash "$src")"
# runHook postUnpack # Calls find...?
echo "Finished executing wheelUnpackPhase"
}
if [ -z "${dontUseWheelUnpack-}" ] && [ -z "${unpackPhase-}" ]; then
echo "Using wheelUnpackPhase"
unpackPhase=wheelUnpackPhase
fi

View file

@ -944,17 +944,34 @@ self: super:
} }
); );
# Stop infinite recursion by using bootstrapped pkg from nixpkgs # Stop infinite recursion by using bootstrapped pkg from nixpkgs
wheel = ( bootstrapped-pip = super.bootstrapped-pip.override {
pkgs.python3.pkgs.override { wheel = (pkgs.python3.pkgs.override {
python = self.python; python = self.python;
} }).wheel;
).wheel.overridePythonAttrs ( };
old: wheel =
if old.format == "other" then old else { let
inherit (super.wheel) pname name version src; isWheel = super.wheel.src.isWheel or false;
} # If "wheel" is a pre-built binary wheel
); wheelPackage = super.buildPythonPackage {
inherit (super.wheel) pname name version src;
inherit (pkgs.python3.pkgs.wheel) meta;
format = "wheel";
};
# If "wheel" is built from source
sourcePackage = (
pkgs.python3.pkgs.override {
python = self.python;
}
).wheel.overridePythonAttrs (
old: {
inherit (super.wheel) pname name version src;
}
);
in
if isWheel then wheelPackage else sourcePackage;
zipp = zipp =
( (