Update build.rs

Co-authored-by: David Hewitt <1939362+davidhewitt@users.noreply.github.com>
This commit is contained in:
messense 2021-03-12 15:50:33 +08:00
parent 884cd9d726
commit 9199c78e1b

View file

@ -401,9 +401,11 @@ fn find_sysconfigdata(cross: &CrossCompileConfig) -> Result<PathBuf> {
let mut sysconfig_paths = sysconfig_paths let mut sysconfig_paths = sysconfig_paths
.iter() .iter()
.filter_map(|p| { .filter_map(|p| {
fs::canonicalize(p) let canonical = fs::canonicalize(p).ok();
.ok() match &sysconfig_name {
.filter(|p| p.file_stem() == sysconfig_name.as_deref()) Some(_) => canonical.filter(|p| p.file_stem() == sysconfig_name.as_deref()),
None => canonical,
}
}) })
.collect::<Vec<PathBuf>>(); .collect::<Vec<PathBuf>>();
sysconfig_paths.dedup(); sysconfig_paths.dedup();