python3Packages.setuptools-rust: fix python version inconsistency

This commit is contained in:
aleksana
2025-12-22 22:25:26 +08:00
parent a05b9af428
commit 9566862485
@@ -13,6 +13,7 @@
setuptools-rust,
setuptools-scm,
replaceVars,
python,
targetPackages,
}:
buildPythonPackage rec {
@@ -44,20 +45,12 @@ buildPythonPackage rec {
# integrate the setup hook to set up the build environment for cross compilation
# this hook is automatically propagated to consumers using setuptools-rust as build-system
#
# Only include the setup hook if targetPackages.python3 is defined.
# targetPackages.python3 is not always available, for example when including
# setuptools-rust via buildInputs instead of nativeBuildInputs or building it directly.
setupHook =
if !(targetPackages ? python3) then
null
else
replaceVars ./setuptools-rust-hook.sh {
pyLibDir = "${targetPackages.python3}/lib/${targetPackages.python3.libPrefix}";
cargoBuildTarget = stdenv.targetPlatform.rust.rustcTargetSpec;
cargoLinkerVar = stdenv.targetPlatform.rust.cargoEnvVarTarget;
targetLinker = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc";
};
setupHook = replaceVars ./setuptools-rust-hook.sh {
pyLibDir = "${python.pythonOnTargetForTarget}/lib/${python.pythonOnTargetForTarget.libPrefix}";
cargoBuildTarget = stdenv.targetPlatform.rust.rustcTargetSpec;
cargoLinkerVar = stdenv.targetPlatform.rust.cargoEnvVarTarget;
targetLinker = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc";
};
passthru.tests = {
pyo3 = maturin.tests.pyo3.override {