571: Describe fallback platform checking using glibc version (#597)

This commit is contained in:
Thomas Kluyver 2018-03-23 07:00:38 +00:00 committed by Nick Coghlan
parent 9ae6b6c739
commit d43b984e02
1 changed files with 25 additions and 0 deletions

View File

@ -261,6 +261,31 @@ the ``_manylinux`` module described in PEP 513. A platform is
considered incompatible with ``manylinux2010`` if the attribute is
``False``.
If the ``_manylinux`` module is not found, or it does not have the attribute
``manylinux2010_compatible``, tools may fall back to checking for glibc. If the
platform has glibc 2.12 or newer, it is assumed to be compatible unless the
``_manylinux`` module says otherwise.
Specifically, the algorithm we propose is::
def is_manylinux2010_compatible():
# Only Linux, and only x86-64 / i686
from distutils.util import get_platform
if get_platform() not in ["linux-x86_64", "linux-i686"]:
return False
# Check for presence of _manylinux module
try:
import _manylinux
return bool(_manylinux.manylinux2010_compatible)
except (ImportError, AttributeError):
# Fall through to heuristic check below
pass
# Check glibc version. CentOS 6 uses glibc 2.12.
# PEP 513 contains an implementation of this function.
return have_compatible_glibc(2, 12)
Backwards compatibility with ``manylinux1`` wheels
==================================================