Skip to content

Commit

Permalink
Always set minor version to 0 when major version >= 11 for macOS (#1778)
Browse files Browse the repository at this point in the history
  • Loading branch information
messense authored Sep 27, 2023
1 parent 5afb0c6 commit 7b85b0e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,21 @@ fn macosx_deployment_target(
arm64_ver = (major, minor);
}
}
Ok((x86_64_ver, arm64_ver))
Ok((
python_macosx_target_version(x86_64_ver),
python_macosx_target_version(arm64_ver),
))
}

#[inline]
fn python_macosx_target_version(version: (u16, u16)) -> (u16, u16) {
let (major, minor) = version;
if major >= 11 {
// pip only supports (major, 0) for macOS 11+
(major, 0)
} else {
(major, minor)
}
}

pub(crate) fn rustc_macosx_target_version(target: &str) -> (u16, u16) {
Expand Down Expand Up @@ -1280,7 +1294,7 @@ mod test {
);
assert_eq!(
macosx_deployment_target(Some("11.1"), false).unwrap(),
((11, 1), (11, 1))
((11, 0), (11, 0))
);
}
}

0 comments on commit 7b85b0e

Please sign in to comment.