From 93d25dda841f320fcd2316ba69d26a935653c451 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Fri, 28 Jul 2023 09:57:50 -0700 Subject: [PATCH] python3.pkgs.pypaBuildHook: switch to pyproject-build Upstream's recommended "python -m build" way of invoking build fails when the working directory contains a file named "build.py". This is common for poetry projects that build C extensions. --- pkgs/development/interpreters/python/hooks/default.nix | 8 +++----- .../interpreters/python/hooks/pypa-build-hook.sh | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix index e241bef042d5..b4f97d08c693 100644 --- a/pkgs/development/interpreters/python/hooks/default.nix +++ b/pkgs/development/interpreters/python/hooks/default.nix @@ -67,11 +67,9 @@ in { makePythonHook { name = "pypa-build-hook.sh"; propagatedBuildInputs = [ build wheel ]; - substitutions = { - inherit pythonInterpreter; - }; - } ./pypa-build-hook.sh) {}; - + } ./pypa-build-hook.sh) { + inherit (pythonForBuild.pkgs) build; + }; pipInstallHook = callPackage ({ makePythonHook, pip }: makePythonHook { diff --git a/pkgs/development/interpreters/python/hooks/pypa-build-hook.sh b/pkgs/development/interpreters/python/hooks/pypa-build-hook.sh index 3b7130049769..5d77613bf565 100644 --- a/pkgs/development/interpreters/python/hooks/pypa-build-hook.sh +++ b/pkgs/development/interpreters/python/hooks/pypa-build-hook.sh @@ -6,7 +6,7 @@ pypaBuildPhase() { runHook preBuild echo "Creating a wheel..." - @pythonInterpreter@ -m build --no-isolation --outdir dist/ --wheel $pypaBuildFlags + pyproject-build --no-isolation --outdir dist/ --wheel $pypaBuildFlags echo "Finished creating a wheel..." runHook postBuild