From 424a3b94ba737b1286c03cce1ebee47753a71188 Mon Sep 17 00:00:00 2001 From: Benjamin Bolte Date: Sun, 27 Oct 2024 22:36:52 -0700 Subject: [PATCH] stuff --- .cargo/config.toml | 6 ++++++ kscaleos/bindings/src/bin/stub_gen.rs | 2 ++ kscaleos/bindings/src/lib.rs | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..f648169 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,6 @@ +[target.aarch64-apple-darwin] + +rustflags = [ + "-C", "link-arg=-undefined", + "-C", "link-arg=dynamic_lookup", +] diff --git a/kscaleos/bindings/src/bin/stub_gen.rs b/kscaleos/bindings/src/bin/stub_gen.rs index ceb1044..20d97e6 100644 --- a/kscaleos/bindings/src/bin/stub_gen.rs +++ b/kscaleos/bindings/src/bin/stub_gen.rs @@ -1,7 +1,9 @@ use pyo3_stub_gen::Result; fn main() -> Result<()> { + println!("Generating stub info..."); let stub = bindings::stub_info()?; + println!("Generating stubs..."); stub.generate()?; Ok(()) } diff --git a/kscaleos/bindings/src/lib.rs b/kscaleos/bindings/src/lib.rs index 8b3d2a0..8417a08 100644 --- a/kscaleos/bindings/src/lib.rs +++ b/kscaleos/bindings/src/lib.rs @@ -1,10 +1,18 @@ use kscaleos::hello_world as kscaleos_hello_world; use pyo3::prelude::*; +use pyo3::{wrap_pyfunction, PyResult}; use pyo3_stub_gen::define_stub_info_gatherer; #[pyfunction] -pub fn hello_world() { +pub fn hello_world() -> PyResult<()> { kscaleos_hello_world(); + Ok(()) +} + +#[pymodule] +fn bindings(m: &Bound) -> PyResult<()> { + m.add_wrapped(wrap_pyfunction!(hello_world))?; + Ok(()) } define_stub_info_gatherer!(stub_info);