From 0b28a477343d342125a757419a8e88e53503c111 Mon Sep 17 00:00:00 2001 From: messense Date: Thu, 18 Feb 2021 14:46:25 +0800 Subject: [PATCH] Change manylinux default version based on target arch --- src/build_options.rs | 10 ++++++---- src/develop.rs | 2 +- src/target.rs | 10 ++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/build_options.rs b/src/build_options.rs index 1093d084e..a23596e86 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -29,9 +29,8 @@ pub struct BuildOptions { long, possible_values = &["2010", "2014", "off"], case_insensitive = true, - default_value = "2010" )] - pub manylinux: Manylinux, + pub manylinux: Option, #[structopt(short, long)] /// The python versions to build wheels for, given as the names of the /// interpreters. Uses autodiscovery if not explicitly set. @@ -77,7 +76,7 @@ pub struct BuildOptions { impl Default for BuildOptions { fn default() -> Self { BuildOptions { - manylinux: Manylinux::Manylinux2010, + manylinux: None, interpreter: Some(vec![]), bindings: None, manifest_path: PathBuf::from("Cargo.toml"), @@ -161,6 +160,9 @@ impl BuildOptions { } let target = Target::from_target_triple(self.target.clone())?; + let manylinux = self + .manylinux + .unwrap_or_else(|| target.get_default_manylinux_tag()); let wheel_dir = match self.out { Some(ref dir) => dir.clone(), @@ -191,7 +193,7 @@ impl BuildOptions { release, strip, skip_auditwheel: self.skip_auditwheel, - manylinux: self.manylinux, + manylinux, cargo_extra_args, rustc_extra_args, interpreter, diff --git a/src/develop.rs b/src/develop.rs index 89108a108..16a40f714 100644 --- a/src/develop.rs +++ b/src/develop.rs @@ -27,7 +27,7 @@ pub fn develop( let python = target.get_venv_python(&venv_dir); let build_options = BuildOptions { - manylinux: Manylinux::Off, + manylinux: Some(Manylinux::Off), interpreter: Some(vec![target.get_python()]), bindings, manifest_path: manifest_file.to_path_buf(), diff --git a/src/target.rs b/src/target.rs index 8b395cb88..76e6fef05 100644 --- a/src/target.rs +++ b/src/target.rs @@ -194,6 +194,16 @@ impl Target { } } + /// Returns the default Manylinux tag for this architecture + pub fn get_default_manylinux_tag(&self) -> Manylinux { + match self.arch { + Arch::AARCH64 | Arch::ARMV7L | Arch::POWERPC64 | Arch::POWERPC64LE => { + Manylinux::Manylinux2014 + } + Arch::X86 | Arch::X86_64 => Manylinux::Manylinux2010, + } + } + /// Returns the platform part of the tag for the wheel name for cffi wheels pub fn get_platform_tag(&self, manylinux: &Manylinux, universal2: bool) -> String { match (&self.os, &self.arch) {