2020-02-23 13:52:57 +00:00
|
|
|
{ python
|
2020-11-27 04:27:13 +01:00
|
|
|
, buildPackages
|
2020-02-23 13:52:57 +00:00
|
|
|
, makeSetupHook
|
2020-04-01 00:10:00 +01:00
|
|
|
, wheel
|
|
|
|
, pip
|
2022-05-08 19:01:23 +02:00
|
|
|
, pkgs
|
2020-02-23 13:52:57 +00:00
|
|
|
}:
|
|
|
|
let
|
2020-11-26 20:28:09 +01:00
|
|
|
callPackage = python.pythonForBuild.pkgs.callPackage;
|
2020-02-23 13:52:57 +00:00
|
|
|
pythonInterpreter = python.pythonForBuild.interpreter;
|
2020-04-01 00:10:00 +01:00
|
|
|
pythonSitePackages = python.sitePackages;
|
2022-05-09 17:27:24 +02:00
|
|
|
|
2022-05-08 19:01:23 +02:00
|
|
|
nonOverlayedPython = pkgs.python3.pythonForBuild.withPackages (ps: [ ps.tomlkit ]);
|
2022-05-09 17:27:24 +02:00
|
|
|
makeRemoveSpecialDependenciesHook = { fields, kind }:
|
|
|
|
nonOverlayedPython.pkgs.callPackage
|
|
|
|
(
|
|
|
|
{}:
|
|
|
|
makeSetupHook
|
|
|
|
{
|
|
|
|
name = "remove-path-dependencies.sh";
|
|
|
|
deps = [ ];
|
|
|
|
substitutions = {
|
|
|
|
# NOTE: We have to use a non-overlayed Python here because otherwise we run into an infinite recursion
|
|
|
|
# because building of tomlkit and its dependencies also use these hooks.
|
|
|
|
pythonPath = nonOverlayedPython.pkgs.makePythonPath [ nonOverlayedPython ];
|
|
|
|
pythonInterpreter = nonOverlayedPython.interpreter;
|
|
|
|
pyprojectPatchScript = "${./pyproject-without-special-deps.py}";
|
|
|
|
fields = fields;
|
|
|
|
kind = kind;
|
|
|
|
};
|
|
|
|
} ./remove-special-dependencies.sh
|
|
|
|
)
|
|
|
|
{ };
|
2020-02-23 13:52:57 +00:00
|
|
|
in
|
|
|
|
{
|
2022-05-09 17:27:24 +02:00
|
|
|
removePathDependenciesHook = makeRemoveSpecialDependenciesHook {
|
|
|
|
fields = [ "path" ];
|
|
|
|
kind = "path";
|
|
|
|
};
|
|
|
|
|
|
|
|
removeGitDependenciesHook = makeRemoveSpecialDependenciesHook {
|
|
|
|
fields = [ "git" "branch" "rev" "tag" ];
|
|
|
|
kind = "git";
|
|
|
|
};
|
2021-11-07 09:50:59 -05:00
|
|
|
|
2020-02-23 13:52:57 +00:00
|
|
|
|
2020-04-29 14:12:59 +01:00
|
|
|
pipBuildHook = callPackage
|
|
|
|
(
|
|
|
|
{ pip, wheel }:
|
2020-05-19 21:06:02 +01:00
|
|
|
makeSetupHook
|
|
|
|
{
|
|
|
|
name = "pip-build-hook.sh";
|
|
|
|
deps = [ pip wheel ];
|
|
|
|
substitutions = {
|
|
|
|
inherit pythonInterpreter pythonSitePackages;
|
|
|
|
};
|
|
|
|
} ./pip-build-hook.sh
|
2020-10-01 19:08:57 +02:00
|
|
|
)
|
|
|
|
{ };
|
2020-04-01 00:10:00 +01:00
|
|
|
|
2020-04-29 14:12:59 +01:00
|
|
|
poetry2nixFixupHook = callPackage
|
|
|
|
(
|
|
|
|
{}:
|
2020-05-19 21:06:02 +01:00
|
|
|
makeSetupHook
|
|
|
|
{
|
|
|
|
name = "fixup-hook.sh";
|
|
|
|
deps = [ ];
|
2022-02-05 21:32:09 +12:00
|
|
|
substitutions = {
|
|
|
|
inherit pythonSitePackages;
|
|
|
|
filenames = builtins.concatStringsSep " " [
|
|
|
|
"pyproject.toml"
|
|
|
|
"README.md"
|
2022-09-07 07:55:10 +12:00
|
|
|
"LICENSE"
|
2022-02-05 21:32:09 +12:00
|
|
|
];
|
|
|
|
};
|
2020-05-19 21:06:02 +01:00
|
|
|
} ./fixup-hook.sh
|
2020-10-01 19:08:57 +02:00
|
|
|
)
|
|
|
|
{ };
|
2020-02-28 19:45:23 +00:00
|
|
|
|
2020-08-17 03:34:58 +02:00
|
|
|
# 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
|
2020-10-01 19:08:57 +02:00
|
|
|
)
|
|
|
|
{ };
|
2020-02-23 13:52:57 +00:00
|
|
|
}
|