Skip to content

Commit

Permalink
Drop manylinux2010 support
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Mar 17, 2022
1 parent f3b094f commit 37f1bd0
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/pypa/manylinux2010_x86_64 as builder
FROM quay.io/pypa/manylinux2014_x86_64 as builder

ENV PATH /root/.cargo/bin:$PATH

Expand All @@ -24,7 +24,7 @@ RUN cargo rustc --bin maturin --manifest-path /maturin/Cargo.toml --release --fe
&& mv /maturin/target/release/maturin /usr/bin/maturin \
&& rm -rf /maturin

FROM quay.io/pypa/manylinux2010_x86_64
FROM quay.io/pypa/manylinux2014_x86_64

ENV PATH /root/.cargo/bin:$PATH
# Add all supported python versions
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ There's a `maturin sdist` command for only building a source distribution as wor
## Manylinux and auditwheel

For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://www.python.org/dev/peps/pep-0571/#the-manylinux2010-policy).
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://peps.python.org/pep-0599/#the-manylinux2014-policy).
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image**.

The Rust compiler since version 1.47 [requires at least glibc 2.11](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1470-2020-10-08), so you need to use at least manylinux2010.
Expand All @@ -232,7 +232,7 @@ maturin contains a reimplementation of auditwheel automatically checks the gener
If your system's glibc is too new or you link other shared libraries, it will assign the `linux` tag.
You can also manually disable those checks and directly use native linux target with `--manylinux off`.

For full manylinux compliance you need to compile in a CentOS docker container. The [pyo3/maturin](https://ghcr.io/pyo3/maturin) image is based on the manylinux2010 image,
For full manylinux compliance you need to compile in a CentOS docker container. The [pyo3/maturin](https://ghcr.io/pyo3/maturin) image is based on the manylinux2014 image,
and passes arguments to the `maturin` binary. You can use it like this:

```
Expand Down
6 changes: 3 additions & 3 deletions guide/src/distribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sdist-include = ["path/**/*"]
## Build Wheels

For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://www.python.org/dev/peps/pep-0571/#the-manylinux2010-policy).
The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://peps.python.org/pep-0599/#the-manylinux2014-policy).
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image** or [build with zig](#use-zig).

The Rust compiler since version 1.47 [requires at least glibc 2.11](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1470-2020-10-08), so you need to use at least manylinux2010.
Expand All @@ -57,7 +57,7 @@ maturin contains a reimplementation of auditwheel automatically checks the gener

You can also manually disable those checks and directly use native linux target with `--manylinux off`.

For full manylinux compliance you need to compile in a CentOS docker container. The [pyo3/maturin](https://ghcr.io/pyo3/maturin) image is based on the manylinux2010 image,
For full manylinux compliance you need to compile in a CentOS docker container. The [pyo3/maturin](https://ghcr.io/pyo3/maturin) image is based on the manylinux2014 image,
and passes arguments to the `maturin` binary. You can use it like this:

```
Expand Down Expand Up @@ -146,7 +146,7 @@ OPTIONS:
--zig
For manylinux targets, use zig to ensure compliance for the chosen manylinux version
Default to manylinux2010/manylinux_2_12 if you do not specify an `--compatibility`
Default to manylinux2014/manylinux_2_17 if you do not specify an `--compatibility`
Make sure you installed zig with `pip install maturin[zig]`
```
Expand Down
9 changes: 9 additions & 0 deletions src/auditwheel/platform_tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ impl PlatformTag {
pub fn is_portable(&self) -> bool {
!matches!(self, PlatformTag::Linux)
}

/// Is it supported by Rust compiler
pub fn is_supported(&self) -> bool {
match self {
PlatformTag::Manylinux { x, y } => (*x, *y) >= (2, 17),
PlatformTag::Musllinux { .. } => true,
PlatformTag::Linux => true,
}
}
}

impl fmt::Display for PlatformTag {
Expand Down
8 changes: 5 additions & 3 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub struct BuildOptions {

/// For manylinux targets, use zig to ensure compliance for the chosen manylinux version
///
/// Default to manylinux2010/manylinux_2_12 if you do not specify an `--compatibility`
/// Default to manylinux2014/manylinux_2_17 if you do not specify an `--compatibility`
///
/// Make sure you installed zig with `pip install maturin[zig]`
#[clap(long)]
Expand Down Expand Up @@ -338,8 +338,10 @@ impl BuildOptions {
None
}
});
if platform_tag == Some(PlatformTag::manylinux1()) {
eprintln!("⚠️ Warning: manylinux1 is unsupported by the Rust compiler.");
if let Some(platform_tag) = platform_tag {
if !platform_tag.is_supported() {
eprintln!("⚠️ Warning: {} is unsupported by the Rust compiler.", platform_tag);
}
}

if !args_from_pyproject.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion src/python_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ impl PythonInterpreter {
}
InterpreterKind::PyPy => {
// pypy uses its version as part of the ABI, e.g.
// pypy 3.7 7.3 => numpy-1.20.1-pp37-pypy37_pp73-manylinux2010_x86_64.whl
// pypy 3.7 7.3 => numpy-1.20.1-pp37-pypy37_pp73-manylinux2014_x86_64.whl
format!(
"pp{major}{minor}-pypy{major}{minor}_{abi_tag}-{platform}",
major = self.major,
Expand Down
7 changes: 1 addition & 6 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,7 @@ impl Target {

/// Returns the oldest possible Manylinux tag for this architecture
pub fn get_minimum_manylinux_tag(&self) -> PlatformTag {
match self.arch {
Arch::Aarch64 | Arch::Armv7L | Arch::Powerpc64 | Arch::Powerpc64Le | Arch::S390X => {
PlatformTag::manylinux2014()
}
Arch::X86 | Arch::X86_64 => PlatformTag::manylinux2010(),
}
PlatformTag::manylinux2014()
}

/// Returns whether the platform is 64 bit or 32 bit
Expand Down
2 changes: 1 addition & 1 deletion tests/common/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn test_integration(
if zig && build_context.target.is_linux() && !build_context.target.is_musl_target() {
assert!(filename
.to_string_lossy()
.ends_with("manylinux_2_12_x86_64.manylinux2010_x86_64.whl"))
.ends_with("manylinux_2_17_x86_64.manylinux2014_x86_64.whl"))
}
let venv_suffix = if supported_version == "py3" {
"py3".to_string()
Expand Down

0 comments on commit 37f1bd0

Please sign in to comment.