Skip to content

Commit

Permalink
Change manylinux default version based on target arch
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Feb 18, 2021
1 parent 53dd4c2 commit 0b28a47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Manylinux>,
#[structopt(short, long)]
/// The python versions to build wheels for, given as the names of the
/// interpreters. Uses autodiscovery if not explicitly set.
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -191,7 +193,7 @@ impl BuildOptions {
release,
strip,
skip_auditwheel: self.skip_auditwheel,
manylinux: self.manylinux,
manylinux,
cargo_extra_args,
rustc_extra_args,
interpreter,
Expand Down
2 changes: 1 addition & 1 deletion src/develop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
10 changes: 10 additions & 0 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0b28a47

Please sign in to comment.