From c8d4bdc8cb0be4d6aa5ff057cdb2d4d231a50aa6 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Sun, 20 Oct 2024 06:37:41 -0400 Subject: [PATCH] fix: npy version issue (#1126) --- src/env_vars.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/env_vars.rs b/src/env_vars.rs index 9863888f..bf8af428 100644 --- a/src/env_vars.rs +++ b/src/env_vars.rs @@ -60,8 +60,8 @@ pub fn python_vars(output: &Output) -> HashMap> { } if let Some(py_ver) = python_version { - let py_ver = py_ver.split('.').collect::>(); - let py_ver_str = format!("{}.{}", py_ver[0], py_ver[1]); + let py_ver: Vec<_> = py_ver.split('.').take(2).collect(); + let py_ver_str = py_ver.join("."); let stdlib_dir = get_stdlib_dir( output.prefix(), output.host_platform().platform, @@ -80,9 +80,9 @@ pub fn python_vars(output: &Output) -> HashMap> { } if let Some(npy_version) = output.variant().get("numpy") { - let np_ver = npy_version.split('.').collect::>(); - let np_ver = format!("{}.{}", np_ver[0], np_ver[1]); - insert!(result, "NPY_VER", np_ver); + let npy_ver: Vec<_> = npy_version.split('.').take(2).collect(); + let npy_ver = npy_ver.join("."); + insert!(result, "NPY_VER", npy_ver); insert!(result, "NPY_DISTUTILS_APPEND_FLAGS", "1"); }