8000 Support cross compiling · Issue #321 · mesonbuild/meson-python · GitHub
[go: up one dir, main page]

Skip to content
Support cross compiling #321
Open
Open
@isuruf

Description

@isuruf

Even though meson supports cross compiling, it seems meson-python does not.

@cached_property
def _stable_abi(self) -> Optional[str]:
"""Determine stabe ABI compatibility.
Examine all files installed in {platlib} that look like
extension modules (extension .pyd on Windows, .dll on Cygwin,
and .so on other platforms) and, if they all share the same
PEP 3149 filename stable ABI tag, return it.
All files that look like extension modules are verified to
have a file name compatibel with what is expected by the
Python interpreter. An exception is raised otherwise.
Other files are ignored.
"""
soext = sorted(_EXTENSION_SUFFIXES, key=len)[0]
abis = []
for path, _ in self._wheel_files['platlib']:
if path.suffix == soext:
match = re.match(r'^[^.]+(.*)$', path.name)
assert match is not None
suffix = match.group(1)
if suffix not in _EXTENSION_SUFFIXES:
raise ValueError(
f'Extension module {str(path)!r} not compatible with Python interpreter. '
f'Filename suffix {suffix!r} not in {set(_EXTENSION_SUFFIXES)}.')
match = _EXTENSION_SUFFIX_REGEX.match(suffix)
assert match is not None
abis.append(match.group('abi'))
stable = [x for x in abis if x and re.match(r'abi\d+', x)]
if len(stable) > 0 and len(stable) == len(abis) and all(x == stable[0] for x in stable[1:]):
return stable[0]
return None
assumes that the extension is run on the same interpreter.
We use crossenv to cross compile in conda-forge and crossenv monkey-patches some things but monkey-patching importlib.machinery.EXTENSION_SUFFIXES does not seem like a good idea.

cc @h-vetinari, @rgommers, @eli-schwartz

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0