From 313177129b521e49d2acc7ad884cf798e3a01b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Sat, 20 Mar 2021 08:38:14 +0100 Subject: [PATCH] python3Packages.setuptools-rust: fix passthru test The build wanted to create a Cargo.lock in the top-level source directory (presumably because it is also a Cargo project), since we were crating the lock file in sourceRoot (which was set to the example project). This failed because the sources are read-only. Change the test to create the lock file in the top-level crate directory, which is Cargo's default behavior. --- .../python-modules/setuptools-rust/pyo3-test/default.nix | 6 +++++- pkgs/development/tools/rust/maturin/pyo3-test/generic.nix | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/setuptools-rust/pyo3-test/default.nix b/pkgs/development/python-modules/setuptools-rust/pyo3-test/default.nix index 9af17aa5159c..31730d6ff2dc 100644 --- a/pkgs/development/python-modules/setuptools-rust/pyo3-test/default.nix +++ b/pkgs/development/python-modules/setuptools-rust/pyo3-test/default.nix @@ -17,5 +17,9 @@ callPackage ../../../tools/rust/maturin/pyo3-test/generic.nix { rust.rustc ]); - sourceRoot = "source/examples/word-count"; + preConfigure = '' + # sourceRoot puts Cargo.lock in the wrong place due to the + # example setup. + cd examples/word-count + ''; } diff --git a/pkgs/development/tools/rust/maturin/pyo3-test/generic.nix b/pkgs/development/tools/rust/maturin/pyo3-test/generic.nix index f82c988fc512..84ca2ddf77f6 100644 --- a/pkgs/development/tools/rust/maturin/pyo3-test/generic.nix +++ b/pkgs/development/tools/rust/maturin/pyo3-test/generic.nix @@ -10,7 +10,7 @@ , buildAndTestSubdir ? null , format ? "pyproject" -, sourceRoot ? "source" +, preConfigure ? "" }: python3Packages.buildPythonPackage rec { @@ -25,14 +25,14 @@ python3Packages.buildPythonPackage rec { }; cargoDeps = rustPlatform.fetchCargoTarball { - inherit src sourceRoot patches; + inherit src patches; name = "${pname}-${version}"; hash = "sha256-//TmozgWy9zrSpMKX92XdHj4fw/T1Elfgn4YhhR7ot0="; }; patches = [ ./Cargo.lock.patch ]; - inherit buildAndTestSubdir format nativeBuildInputs sourceRoot; + inherit buildAndTestSubdir format nativeBuildInputs preConfigure; pythonImportsCheck = [ "word_count" ];