Fix `cargo test` with `extension-module` feature.
Fixes #1084 Fixes #771 Fixes #341 Fixes #340
👍 thanks!
It would also be worth adding cargo test (and cargo run) n CI to one of the examples crates, so that we know this is working as expected!
Regarding current failure - in order to get Paramus I need interpreter config which currently is initialized only if derive configuration feature is enabled. Not sure what's the best solution here..
add_extension_module_link_args should probably be #[cfg(feature = "resolve-config")] - and you can then pass &InterpreterConfig through to _add_extension_module_link_args.
Not sure about cargo run/test - they don't seem to have any. You suggest adding a sanity test there also and running it?
Yep exactly, can add something simple to prove it works 😊
I can't make an example fail on my setup for some reason (macOS, arm). Some help would be appreciated
See #2147
Thanks @davidhewitt. I can reproduce it using the example you made.
I'm now stuck at the compiler not letting it compile due to ignored flag -
invalid instructioncargo:rustc-link-arg-binsfrom build script ofmaturin-starter v0.1.0 (pyo3/examples/maturin-starter)The package maturin-starter v0.1.0 (maturin-starter) does not have a bin target.
I think we have to change the implementation on pyo3 build config to consider what it is compiling (test/binary). is that information available from a build script context tho?
Oh, yikes. I have to confess I don't know. Might be possible to extract it from the Cargo.toml?
But I don’t think we can extract what we’re compiling exactly?
On Sat, 5 Feb 2022 at 19:37 David Hewitt @.***> wrote:
Oh, yikes. I have to confess I don't know. Might be possible to extract it from the Cargo.toml?
— Reply to this email directly, view it on GitHub https://github.com/PyO3/pyo3/pull/2135#issuecomment-1030666416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ2LCBCBDA6IKSKEZCJCRZLUZVN6LANCNFSM5NF3MFIQ . You are receiving this because you authored the thread.Message ID: @.***>
But I don’t think we can extract what we’re compiling exactly?
Does checking the CARGO_BIN_NAME environment variable (whether it is empty or not) help with this?
I think we might be able to use CARGO_MANIFEST_DIR in conjunction with cargo metadata to figure out what the crate of the currently running build script contains (and maybe even which of those things depend on pyo3).
when merge?
when merge?
The PR isn't ready yet because I didn't think it through enough. We need to find a way to set the flags only on specific builds, which isn't as easy as one would think. I'm currently swamped by work & life so if someone wants to keep this moving they're more than welcome.
when merge?
The PR isn't ready yet because I didn't think it through enough. We need to find a way to set the flags only on specific builds, which isn't as easy as one would think. I'm currently swamped by work & life so if someone wants to keep this moving they're more than welcome.
no worries man, I don't have the expertise yet to help you out, I will try to figure out a workaround