Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manylinux_2_27 support #521

Merged
merged 3 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

* Add `manylinux_2_27` support in [#521](https://github.com/PyO3/maturin/pull/521)

## 0.10.4 - 2021-04-28

* Interpreter search now uses python 3.6 to 3.12 in [#495](https://github.com/PyO3/maturin/pull/495)
Expand Down
20 changes: 10 additions & 10 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,14 @@ OPTIONS:
The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not
explicitly set
--manylinux <manylinux>
Control the platform tag on linux. Options are `2010` (for manylinux2010), `2014` (for manylinux2014),
`2_24` (for manylinux_2_24) and `off` (for the native linux tag). Note that manylinux1 is unsupported by the
rust compiler. Wheels with the native `linux` tag will be rejected by pypi, unless they are separately
validated by `auditwheel`.
Control the platform tag on linux. Options are `2010`/`2_12` (for manylinux2010), `2014`/`2_17` (for
manylinux2014), `2_24` (for manylinux_2_24), `2_27` (for manylinux_2_27) and `off` (for the native linux
tag). Note that manylinux1 is unsupported by the rust compiler. Wheels with the native `linux` tag will be
rejected by pypi, unless they are separately validated by `auditwheel`.

The default is the lowest compatible, of plain `linux` if nothing matched

This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_24, off]
This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_12, 2_17, 2_24, 2_27, 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 @@ -311,14 +311,14 @@ OPTIONS:
The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not
explicitly set
--manylinux <manylinux>
Control the platform tag on linux. Options are `2010` (for manylinux2010), `2014` (for manylinux2014),
`2_24` (for manylinux_2_24) and `off` (for the native linux tag). Note that manylinux1 is unsupported by the
rust compiler. Wheels with the native `linux` tag will be rejected by pypi, unless they are separately
validated by `auditwheel`.
Control the platform tag on linux. Options are `2010`/`2_12` (for manylinux2010), `2014`/`2_17` (for
manylinux2014), `2_24` (for manylinux_2_24), `2_27` (for manylinux_2_27) and `off` (for the native linux
tag). Note that manylinux1 is unsupported by the rust compiler. Wheels with the native `linux` tag will be
rejected by pypi, unless they are separately validated by `auditwheel`.

The default is the lowest compatible, of plain `linux` if nothing matched

This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_24, off]
This option is ignored on all non-linux platforms [possible values: 2010, 2014, 2_12, 2_17, 2_24, 2_27, 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
2 changes: 1 addition & 1 deletion src/auditwheel/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub fn auditwheel_rs(
println!(
"📦 Wheel is eligible for a higher priority tag. \
You requested {} but this wheel is eligible for {}",
policy.name, highest_policy.name,
policy, highest_policy,
);
}
}
Expand Down
64 changes: 45 additions & 19 deletions src/auditwheel/manylinux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,42 @@ use std::str::FromStr;
/// Decides how to handle manylinux compliance
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq, Copy)]
pub enum Manylinux {
/// Use the manylinux1 tag
Manylinux1,
/// Use the manylinux2010 tag
Manylinux2010,
/// Use the manylinux2014 tag
Manylinux2014,
/// Use the manylinux_2_24 tag
#[allow(non_camel_case_types)]
Manylinux_2_24,
/// Use the manylinux_x_y tag
Manylinux {
/// GLIBC version major
x: u16,
/// GLIBC version minor
y: u16,
},
/// Use the native linux tag
Off,
}

impl Manylinux {
fn new(x: u16, y: u16) -> Self {
Self::Manylinux { x, y }
}

/// `manylinux1` aka `manylinux_2_5`
pub fn manylinux1() -> Self {
Self::Manylinux { x: 2, y: 5 }
}

/// `manylinux2010` aka `manylinux_2_12`
pub fn manylinux2010() -> Self {
Self::Manylinux { x: 2, y: 12 }
}

/// `manylinux2014` aka `manylinux_2_17`
pub fn manylinux2014() -> Self {
Self::Manylinux { x: 2, y: 17 }
}
}

impl fmt::Display for Manylinux {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Manylinux::Manylinux1 => write!(f, "manylinux1"),
Manylinux::Manylinux2010 => write!(f, "manylinux2010"),
Manylinux::Manylinux2014 => write!(f, "manylinux2014"),
Manylinux::Manylinux_2_24 => write!(f, "manylinux_2_24"),
Manylinux::Manylinux { x, y } => write!(f, "manylinux_{}_{}", x, y),
Manylinux::Off => write!(f, "linux"),
}
}
Expand All @@ -35,13 +51,23 @@ impl FromStr for Manylinux {

fn from_str(value: &str) -> anyhow::Result<Self, Self::Err> {
match value {
"auto" => Ok(Manylinux::Manylinux1),
"1" | "manylinux1" => Ok(Manylinux::Manylinux1),
"2010" | "manylinux2010" => Ok(Manylinux::Manylinux2010),
"2014" | "manylinux2014" => Ok(Manylinux::Manylinux2014),
"2_24" | "manylinux_2_24" => Ok(Manylinux::Manylinux_2_24),
"off" | "linux" => Ok(Manylinux::Off),
_ => Err("Invalid value for the manylinux option"),
"auto" | "1" | "manylinux1" => Ok(Manylinux::manylinux1()),
"2010" | "manylinux2010" => Ok(Manylinux::manylinux2010()),
"2014" | "manylinux2014" => Ok(Manylinux::manylinux2014()),
_ => {
let value = value.strip_prefix("manylinux_").unwrap_or(value);
let mut parts = value.split('_');
let x = parts
.next()
.and_then(|x| x.parse::<u16>().ok())
.ok_or("invalid manylinux option")?;
let y = parts
.next()
.and_then(|y| y.parse::<u16>().ok())
.ok_or("invalid manylinux option")?;
Ok(Manylinux::new(x, y))
}
}
}
}
Loading