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 19, 2021
1 parent 7e34a32 commit 7c43487
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (for the cli, not for the crate).

## Unreleased

* Change manylinux default version based on target arch by messense in [#424](https://github.com/PyO3/maturin/pull/424)

## 0.9.4 - 2021-02-18

* Fix building a bin with musl
Expand Down
8 changes: 6 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ OPTIONS:
`off` (for the native linux tag). Note that manylinux1 is unsupported by the rust compiler. Wheels with the
native tag will be rejected by pypi, unless they are separately validated by `auditwheel`.
This option is ignored on all non-linux platforms [default: 2010] [possible values: 2010, 2014, off]
The default is the lowest supported value for a target, which is 2010 for x86 and 2014 for arm and powerpc.
This option is ignored on all non-linux platforms [possible values: 2010, 2014, off]
-o, --out <out>
The directory to store the built wheels in. Defaults to a new "wheels" directory in the project's target
directory
Expand Down Expand Up @@ -305,7 +307,9 @@ OPTIONS:
`off` (for the native linux tag). Note that manylinux1 is unsupported by the rust compiler. Wheels with the
native tag will be rejected by pypi, unless they are separately validated by `auditwheel`.
This option is ignored on all non-linux platforms [default: 2010] [possible values: 2010, 2014, off]
The default is the lowest supported value for a target, which is 2010 for x86 and 2014 for arm and powerpc.
This option is ignored on all non-linux platforms [possible values: 2010, 2014, off]
-o, --out <out>
The directory to store the built wheels in. Defaults to a new "wheels" directory in the project's target
directory
Expand Down
13 changes: 9 additions & 4 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ pub struct BuildOptions {
/// will be rejected by pypi, unless they are separately validated by
/// `auditwheel`.
///
/// The default is the lowest supported value for a target, which is 2010 for x86 and 2014 for
/// arm and powerpc.
///
/// This option is ignored on all non-linux platforms
#[structopt(
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 +79,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 +163,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 +196,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 7c43487

Please sign in to comment.