python3.pkgs.bootstrap.build: init at 0.10.0

Co-authored-by: K900 <me@0upti.me>
This commit is contained in:
Theodore Ni 2023-07-26 00:58:09 -07:00 committed by Frederik Rietdijk
parent 8fe3d15c17
commit b53cef70f2
2 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,49 @@
{ lib
, stdenv
, python
, build
, flit-core
, installer
, packaging
, pyproject-hooks
, tomli
}:
let
buildBootstrapPythonModule = basePackage: attrs: stdenv.mkDerivation ({
pname = "${python.libPrefix}-bootstrap-${basePackage.pname}";
inherit (basePackage) version src meta;
buildPhase = ''
runHook preBuild
PYTHONPATH="${flit-core}/${python.sitePackages}" \
${python.interpreter} -m flit_core.wheel
runHook postBuild
'';
installPhase = ''
runHook preInstall
PYTHONPATH="${installer}/${python.sitePackages}" \
${python.interpreter} -m installer \
--destdir "$out" --prefix "" dist/*.whl
runHook postInstall
'';
} // attrs);
bootstrap-packaging = buildBootstrapPythonModule packaging {};
bootstrap-pyproject-hooks = buildBootstrapPythonModule pyproject-hooks {};
bootstrap-tomli = buildBootstrapPythonModule tomli {};
in
buildBootstrapPythonModule build {
propagatedBuildInputs = [
bootstrap-packaging
bootstrap-pyproject-hooks
] ++ lib.optionals (python.pythonOlder "3.11") [
bootstrap-tomli
];
}

View File

@ -13,6 +13,9 @@ self: super: with self; {
installer = toPythonModule (callPackage ../development/python-modules/bootstrap/installer {
inherit (bootstrap) flit-core;
});
build = toPythonModule (callPackage ../development/python-modules/bootstrap/build {
inherit (bootstrap) flit-core installer;
});
};
bootstrapped-pip = toPythonModule (callPackage ../development/python-modules/bootstrapped-pip { });