Skip to content

Support cross compiling #321

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= []
forpath, _inself._wheel_files['platlib']:
ifpath.suffix==soext:
match=re.match(r'^[^.]+(.*)$', path.name)
assertmatchisnotNone
suffix=match.group(1)
ifsuffixnotin_EXTENSION_SUFFIXES:
raiseValueError(
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)
assertmatchisnotNone
abis.append(match.group('abi'))
stable= [xforxinabisifxandre.match(r'abi\d+', x)]
iflen(stable) >0andlen(stable) ==len(abis) andall(x==stable[0] forxinstable[1:]):
returnstable[0]
returnNone
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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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