Skip to content

Commit 27af589

Browse files
committed
Makes sure to inject the module name
1 parent b5efccb commit 27af589

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

noxfile.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,16 @@ def test_introspection(session: nox.Session):
14391439
"import pyo3_pytests; print(pyo3_pytests.pyo3_pytests.__file__)",
14401440
silent=True,
14411441
).strip()
1442-
_run_cargo(session, "run", "-p", "pyo3-introspection", "--", lib_file, stub_dir)
1442+
_run_cargo(
1443+
session,
1444+
"run",
1445+
"-p",
1446+
"pyo3-introspection",
1447+
"--",
1448+
lib_file,
1449+
"pyo3_pytests",
1450+
stub_dir,
1451+
)
14431452
_run(session, "ruff", "format", stub_dir)
14441453
_ensure_directory_equals(Path(stub_dir), Path("pytests/stubs"))
14451454

pyo3-introspection/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use std::path::Path;
66
use std::{env, fs};
77

88
fn main() -> Result<()> {
9-
let [_, binary_path, output_path] = env::args().collect::<Vec<_>>().try_into().map_err(|_| anyhow!("pyo3-introspection takes two arguments, the path of the binary to introspect and the path of the directory to write the stub to"))?;
10-
let module = introspect_cdylib(&binary_path, "pyo3_pytests")
9+
let [_, binary_path, module_name, output_path] = env::args().collect::<Vec<_>>().try_into().map_err(|_| anyhow!("pyo3-introspection takes three arguments, the path of the binary to introspect, the name of the python module to introspect and and the path of the directory to write the stub to"))?;
10+
let module = introspect_cdylib(&binary_path, &module_name)
1111
.with_context(|| format!("Failed to introspect module {binary_path}"))?;
1212
let actual_stubs = module_stub_files(&module);
1313
for (path, module) in actual_stubs {

0 commit comments

Comments
 (0)