From 70df6795ec5f3bbf7573596566dfef256af0c357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Padarian?= Date: Sun, 15 May 2022 15:16:55 +1000 Subject: [PATCH] Work around docs.rs problem with cargo (ref #240) --- Cargo.toml | 2 ++ build.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 46be514c..1272b726 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ edition = "2021" default = [] bindgen = ["gdal-sys/bindgen"] array = ["ndarray"] +docsrs = [] [dependencies] thiserror = "1.0" @@ -38,3 +39,4 @@ members = ["gdal-sys"] [package.metadata.docs.rs] rustc-args = ["--cfg", "docsrs"] +features = [ "docsrs" ] diff --git a/build.rs b/build.rs index 04b27b89..43c6edae 100644 --- a/build.rs +++ b/build.rs @@ -1,11 +1,11 @@ use std::str::FromStr; -#[cfg(docsrs)] +#[cfg(feature = "docsrs")] pub fn gdal_version_info(_key: &str) -> String { "3020000".to_string() } -#[cfg(not(docsrs))] +#[cfg(not(feature = "docsrs"))] pub fn gdal_version_info(key: &str) -> String { let c_key = std::ffi::CString::new(key.as_bytes()).unwrap();