nanobind-sys/build.rs

changeset 3
c3a4f4bb87f7
parent 1
a4137aedcb3a
--- a/nanobind-sys/build.rs	Thu Feb 26 09:32:12 2026 -0500
+++ b/nanobind-sys/build.rs	Wed Apr 22 22:32:00 2026 -0500
@@ -17,7 +17,7 @@
 
 fn main() -> Result<(), anyhow::Error> {
     // Need to build it
-    let (pyc_e, py_conda) = python_config();
+    let (pyc_e, prefix_override, py_type) = python_config();
 
     // This is very clumsy due to PythonConfig::Error not supporting
     // conversion into std::error::Error, just std::io::Error.
@@ -28,11 +28,11 @@
         })
         .map_err(|e| anyhow::Error::from(std::io::Error::from(e)))?;
 
-    let nanobind_root = pyc
-        .prefix_path().ok()
-        .zip(pyc.semantic_version().ok())
-        .and_then(|(prefix, version)| {
-            info!("{}Python {} found at prefix {}", if py_conda { "Conda " } else { ""}, version, prefix.display());
+    let prefix = prefix_override.ok_or_else(|| pyc.prefix_path()).unwrap();
+    let version = pyc.semantic_version().unwrap();
+
+    let nanobind_root = ({
+            info!("{}{}Python {} found at prefix {}", py_type.unwrap_or(""), if py_type.is_none() { "" } else { " "},  version, prefix.display());
             let nanobind_root = prefix
                 .join("lib")
                 .join(format!("python{}.{}", version.major, version.minor))

mercurial