Make lib iteration platform-specific (#5406)

This commit is contained in:
Charlie Marsh 2023-06-28 09:52:20 -04:00 committed by GitHub
parent 6587fb844a
commit 979049b2a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 8 deletions

View file

@ -5,3 +5,16 @@ pub(crate) enum PythonPlatform {
Linux,
Windows,
}
impl PythonPlatform {
/// Returns the platform-specific library names. These are the candidate names for the top-level
/// subdirectory within a virtual environment that contains the `site-packages` directory
/// (with a `pythonX.Y` directory in-between).
pub(crate) fn lib_names(&self) -> &[&'static str] {
match self {
PythonPlatform::Darwin => &["lib"],
PythonPlatform::Linux => &["lib", "lib64"],
PythonPlatform::Windows => &["Lib"],
}
}
}