Mercurial > public > mercurial-scm > hg-stable
changeset 52787:0f9ed7e7a71b
rust-pyo3: make mercurial.pyo3_rustext a proper package
This was not necessary with rust-cpython, and gets reflected in
`__name__` immediately.
author | Georges Racinet <georges.racinet@cloudcrane.io> |
---|---|
date | Fri, 20 Dec 2024 20:40:09 +0100 |
parents | e9ced84aeef4 |
children | 264047bf4b9b |
files | rust/hg-pyo3/src/lib.rs |
diffstat | 1 files changed, 2 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-pyo3/src/lib.rs Fri Feb 07 16:07:39 2025 -0500 +++ b/rust/hg-pyo3/src/lib.rs Fri Dec 20 20:40:09 2024 +0100 @@ -9,14 +9,12 @@ #[pymodule] fn pyo3_rustext(py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { + m.add("__package__", "mercurial")?; m.add( "__doc__", "Mercurial core concepts - Rust implementation exposed via PyO3", )?; - // the module's __name__ is pyo3_rustext, not mercurial.pyo3_rustext - // (at least at this point). - let name: String = m.getattr("__name__")?.extract()?; - let dotted_name = format!("mercurial.{}", name); + let dotted_name: String = m.getattr("__name__")?.extract()?; m.add_submodule(&ancestors::init_module(py, &dotted_name)?)?; m.add_submodule(&dagops::init_module(py, &dotted_name)?)?;