-
-
Notifications
You must be signed in to change notification settings - Fork 18k
python3Packages.cryptography: fix invalid platform for Rust on cross-… #208401
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 | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,8 +2,12 @@ | |||||||||||||||||||||||||||||||||||||||||||
| , stdenv | ||||||||||||||||||||||||||||||||||||||||||||
| , callPackage | ||||||||||||||||||||||||||||||||||||||||||||
| , buildPythonPackage | ||||||||||||||||||||||||||||||||||||||||||||
| , python | ||||||||||||||||||||||||||||||||||||||||||||
| , fetchPypi | ||||||||||||||||||||||||||||||||||||||||||||
| , rustPlatform | ||||||||||||||||||||||||||||||||||||||||||||
| , rust | ||||||||||||||||||||||||||||||||||||||||||||
| , rustc | ||||||||||||||||||||||||||||||||||||||||||||
| , cargo | ||||||||||||||||||||||||||||||||||||||||||||
| , setuptools-rust | ||||||||||||||||||||||||||||||||||||||||||||
| , openssl | ||||||||||||||||||||||||||||||||||||||||||||
| , Security | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -47,9 +51,11 @@ buildPythonPackage rec { | |||||||||||||||||||||||||||||||||||||||||||
| nativeBuildInputs = lib.optionals (!isPyPy) [ | ||||||||||||||||||||||||||||||||||||||||||||
| cffi | ||||||||||||||||||||||||||||||||||||||||||||
| ] ++ [ | ||||||||||||||||||||||||||||||||||||||||||||
| rustPlatform.cargoSetupHook | ||||||||||||||||||||||||||||||||||||||||||||
| setuptools-rust | ||||||||||||||||||||||||||||||||||||||||||||
| ] ++ (with rustPlatform; [ rust.cargo rust.rustc ]); | ||||||||||||||||||||||||||||||||||||||||||||
| rustPlatform.cargoSetupHook | ||||||||||||||||||||||||||||||||||||||||||||
| rustc | ||||||||||||||||||||||||||||||||||||||||||||
| cargo | ||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| buildInputs = [ openssl ] | ||||||||||||||||||||||||||||||||||||||||||||
| ++ lib.optionals stdenv.isDarwin [ Security libiconv ]; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -69,6 +75,11 @@ buildPythonPackage rec { | |||||||||||||||||||||||||||||||||||||||||||
| pytz | ||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| CARGO_BUILD_TARGET = "${rust.toRustTargetSpec stdenv.hostPlatform}"; | ||||||||||||||||||||||||||||||||||||||||||||
| PYO3_CROSS_LIB_DIR = "${python}/lib/${python.libPrefix}"; | ||||||||||||||||||||||||||||||||||||||||||||
| "CARGO_TARGET_${lib.toUpper (builtins.replaceStrings ["-"] ["_"] (rust.toRustTarget stdenv.hostPlatform))}_LINKER" = | ||||||||||||||||||||||||||||||||||||||||||||
| "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+78
to
+81
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. i recommend adding a setup hook to setuptools-rust that does these CARGO_BUILD_TARGET_TARGET = "${rust.toRustTargetSpec targetPackages.stdenv.hostPlatform}";
PYO3_CROSS_LIB_DIR_TARGET = "${targetPackages.python}/lib/${targetPackages.python.libPrefix}";
CARGO_LINKER_VAR = "CARGO_TARGET_${lib.toUpper (builtins.replaceStrings ["-"] ["_"] (rust.toRustTarget targetPackages.stdenv.hostPlatform))}_LINKER"
TARGET_LINKER = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc";add the above to the setuptools-rust and a setup hook that exports them export CARGO_BUILD_TARGET_TARGET=@CARGO_BUILD_TARGET@
export PYO3_CROSS_LIB_DIR_TARGET=@PYO3_CROSS_LIB_DIR@
export @CARGO_LINKER_VAR@=@TARGET_LINKER@
Comment on lines
+78
to
+81
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.
Suggested change
Are those generic variables we want to set?
Contributor
Author
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. That is the question... I took those variables from here https://github.com/PyO3/setuptools-rust/blob/main/.github/workflows/ci.yml#L270 and here PyO3/setuptools-rust#294 (comment). The
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.
Especially weird given that we already do this: nixpkgs/pkgs/build-support/rust/hooks/default.nix Lines 98 to 110 in 06542b2
|
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| pytestFlagsArray = [ | ||||||||||||||||||||||||||||||||||||||||||||
| "--disable-pytest-warnings" | ||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
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.
Can we assert/check in a setup hook this somewhere to make sure this is correct?
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.
Or should this be propagated inputs for
setuptools-rust?