Cross-Compiling Environment

This section documents the changes to the Python environment beyond just making cross-python behave like host-python.

Environment variables

Crossenv sets PYTHON_CROSSENV to a non-empty value.

The sys module

sys.cross_compiling

Set to True in cross-python. May be used like so:

if getattr(sys, 'cross_compiling', False):
    ...
sys.build_path

Analagous to sys.path, but applies when importing packages from build-python. This path is searched just before the entries on sys.path that point to the Python standard library. This means that sys.build_path is preferred when loading modules from the standard library, but prepending to sys.path still works as expected.

The os module

os.uname()

In addition to returning host-python’s information, it always reports the node as “build”.

The platform module

platform.uname()

In addition to returning host-python’s information, it always reports the node as “build”.