-
-
Notifications
You must be signed in to change notification settings - Fork 19.5k
python3Packages.setuptools-rust: fix cross build for all setuptools-rust based packages
#467817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| { | ||
| lib, | ||
| stdenv, | ||
| buildPythonPackage, | ||
| fetchPypi, | ||
| maturin, | ||
|
|
@@ -11,8 +12,9 @@ | |
| setuptools, | ||
| setuptools-rust, | ||
| setuptools-scm, | ||
| replaceVars, | ||
| targetPackages, | ||
| }: | ||
|
|
||
| buildPythonPackage rec { | ||
| pname = "setuptools-rust"; | ||
| version = "1.12.0"; | ||
|
|
@@ -40,6 +42,23 @@ buildPythonPackage rec { | |
|
|
||
| doCheck = false; | ||
|
|
||
| # 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}"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default version of python is incorrectly introduced here, instead of the correct one corresponding to This is causing |
||
| 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 { | ||
| format = "setuptools"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't you use these variables in the
setputools-rust.setupHook?