From cfedd876967e2096ab5bd5218c2dc07b069335d1 Mon Sep 17 00:00:00 2001 From: mejrs Date: Thu, 24 Jun 2021 12:38:15 +0200 Subject: [PATCH] automagically update pyo3 version in toml examples --- src/lib.rs | 8 ++++++-- src/num_bigint.rs | 8 ++++++-- src/num_complex.rs | 7 ++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fa7b0f39..77e72b37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -150,7 +150,9 @@ //! crate-type = ["cdylib"] //! //! [dependencies.pyo3] -//! version = "0.13.2" +// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 +#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")))] +#![cfg_attr(not(docsrs), doc = "version = \"*\"")] //! features = ["extension-module"] //! ``` //! @@ -202,7 +204,9 @@ //! //! ```toml //! [dependencies.pyo3] -//! version = "0.13.2" +// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 +#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("version = \"", env!("CARGO_PKG_VERSION"), "\"")))] +#![cfg_attr(not(docsrs), doc = "version = \"*\"")] //! # this is necessary to automatically initialize the Python interpreter //! features = ["auto-initialize"] //! ``` diff --git a/src/num_bigint.rs b/src/num_bigint.rs index aa205025..ee188f8a 100644 --- a/src/num_bigint.rs +++ b/src/num_bigint.rs @@ -17,9 +17,13 @@ //! //! ```toml //! [dependencies] -//! # change * to the latest versions //! num-bigint = "*" -//! pyo3 = { version = "*", features = ["num-bigint"] } +// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 +#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"num-bigint\"] }")))] +#![cfg_attr( + not(docsrs), + doc = "pyo3 = { version = \"*\", features = [\"num-bigint\"] }" +)] //! ``` //! //! Note that you must use compatible versions of num-bigint and PyO3. diff --git a/src/num_complex.rs b/src/num_complex.rs index 4e4776a0..8ccd4210 100644 --- a/src/num_complex.rs +++ b/src/num_complex.rs @@ -14,7 +14,12 @@ //! [dependencies] //! # change * to the latest versions //! num-complex = "*" -//! pyo3 = { version = "*", features = ["num-complex"] } +// workaround for `extended_key_value_attributes`: https://github.com/rust-lang/rust/issues/82768#issuecomment-803935643 +#![cfg_attr(docsrs, cfg_attr(docsrs, doc = concat!("pyo3 = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"num-complex\"] }")))] +#![cfg_attr( + not(docsrs), + doc = "pyo3 = { version = \"*\", features = [\"num-complex\"] }" +)] //! ``` //! //! Note that you must use compatible versions of num-complex and PyO3.