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
.iter()
.filter_map(|p| {
fs::canonicalize(p)
.ok()
.filter(|p| p.file_stem() == sysconfig_name.as_deref())
let canonical = fs::canonicalize(p).ok();
match &sysconfig_name {
Some(_) => canonical.filter(|p| p.file_stem() == sysconfig_name.as_deref()),
None => canonical,
}
})
.collect::<Vec<PathBuf>>();
sysconfig_paths.dedup();