Skip to content
Open
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
23 changes: 22 additions & 1 deletion docs/guide/crosscompile.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ correct suffix. These values are set by cibuildwheel when cross-compiling.

It should be possible to cross-compile to Linux, but due to the challenges of
getting the manylinux RHEL devtoolkit compilers, this is currently a TODO. See
`py-build-cmake <https://tttapa.github.io/py-build-cmake/Cross-compilation.html>`\_
[py-build-cmake](https://tttapa.github.io/py-build-cmake/Cross-compilation.html)
for an alternative package's usage of toolchain files.

### Intel to Emscripten (Pyodide)
Expand All @@ -64,3 +64,24 @@ by setting `_PYTHON_SYSCONFIGDATA_NAME`. This causes values like `SOABI` and
This is unfortunately incorrectly stripped from the cmake wrapper pyodide uses,
so FindPython will report the wrong values, but pyodide-build will rename the
.so's afterwards.

## Android

To build for Android, you'll need the following items, all of which will be
provided automatically if you use cibuildwheel:

- A Python environment in which `sys.platform`, `sysconfig`, etc. all simulate
Android.
- A
[`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/envvar/CMAKE_TOOLCHAIN_FILE.html)
environment variable, pointing to a file which does at least the following:
- Set `CMAKE_SYSTEM_NAME`, `CMAKE_SYSTEM_PROCESSOR` and
`CMAKE_SYSTEM_VERSION`.
- Set `CMAKE_FIND_ROOT_PATH` to the location of the Python headers and
libraries.
- Set `CMAKE_CROSSCOMPILING_EMULATOR` to `/bin/sh -c [["$0" "$@"]]`. This
allows CMake to run Python in the simulated Android environment when policy
[CMP0190](https://cmake.org/cmake/help/latest/policy/CMP0190.html) is
active.
- Compiler paths and flags, either in the toolchain file or in environment
variables.
2 changes: 1 addition & 1 deletion docs/guide/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ is missing some value you need, please open an issue and let us know.

## Finding Python

One common mistake when using FindPython is to forget to only request the
When using `find_package(Python ...)`, you should only request the
`Development.Module` component. If you request `Development`, you will also
require the `Development.Embed` component, which will require the Python
libraries to be found for linking. When building a module on Unix, you do not
Expand Down
12 changes: 11 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import sysconfig
from importlib import metadata
from pathlib import Path
from typing import Any, Literal, overload
from typing import TYPE_CHECKING, Any, Literal, overload

import virtualenv as _virtualenv

Expand All @@ -19,6 +19,8 @@
else:
import tomllib

if TYPE_CHECKING:
from pytest_subprocess import FakeProcess

import pytest
from packaging.requirements import Requirement
Expand All @@ -30,6 +32,14 @@
VIRTUALENV_VERSION = Version(metadata.version("virtualenv"))


@pytest.fixture
def fp(fp: FakeProcess) -> FakeProcess:
# For program_search._macos_binary_is_x86
fp.register(["lipo", fp.any()], returncode=1)
fp.register(["file", fp.any()], returncode=1)
return fp


@pytest.fixture(scope="session")
def pep518_wheelhouse(tmp_path_factory: pytest.TempPathFactory) -> Path:
wheelhouse = tmp_path_factory.mktemp("wheelhouse")
Expand Down