13 buildBootstrapPythonModule = basePackage: attrs: stdenv.mkDerivation ({
14 pname = "${python.libPrefix}-bootstrap-${basePackage.pname}";
15 inherit (basePackage) version src meta;
17 nativeBuildInputs = [ makeWrapper ];
22 PYTHONPATH="${flit-core}/${python.sitePackages}" \
23 ${python.interpreter} -m flit_core.wheel
31 PYTHONPATH="${installer}/${python.sitePackages}" \
32 ${python.interpreter} -m installer \
33 --destdir "$out" --prefix "" dist/*.whl
39 bootstrap-packaging = buildBootstrapPythonModule packaging {};
41 bootstrap-pyproject-hooks = buildBootstrapPythonModule pyproject-hooks {};
43 bootstrap-tomli = buildBootstrapPythonModule tomli {};
45 sitePkgs = python.sitePackages;
47 buildBootstrapPythonModule build {
48 # like the installPhase above, but wrapping the pyproject-build command
49 # to set up PYTHONPATH with the correct dependencies.
50 # This allows using `pyproject-build` without propagating its dependencies
51 # into the build environment, which is necessary to prevent
52 # pythonCatchConflicts from raising false positive alerts.
53 # This would happen whenever the package to build has a dependency on
54 # another version of a package that is also a dependency of pyproject-build.
58 PYTHONPATH="${installer}/${python.sitePackages}" \
59 ${python.interpreter} -m installer \
60 --destdir "$out" --prefix "" dist/*.whl
62 wrapProgram $out/bin/pyproject-build \
63 --prefix PYTHONPATH : "$out/${sitePkgs}" \
64 --prefix PYTHONPATH : "${bootstrap-pyproject-hooks}/${sitePkgs}" \
65 --prefix PYTHONPATH : "${bootstrap-packaging}/${sitePkgs}" \
66 --prefix PYTHONPATH : "${bootstrap-tomli}/${sitePkgs}"