stubber.freeze.common

common functions for frozen stub generation

Functions

get_portboard(→ Tuple[str, str, str])

returns a 3-tuple of the port, board and variant in the provided manifest path.

get_freeze_path(→ Tuple[pathlib.Path, str])

get path to a folder to store the frozen stubs for the given port/board/variant.

apply_frozen_module_fixes(freeze_path, mpy_path)

apply common fixes to the fozen modules to improve stub generation

Module Contents

stubber.freeze.common.get_portboard(manifest_path: pathlib.Path) Tuple[str, str, str]

returns a 3-tuple of the port, board and variant in the provided manifest path.

Stand-alone ports (e.g. webassembly, unix, windows) do not use a boards/<board>/ subfolder, but may have one or more variants/<variant>/ subfolders. For these the board field is empty while variant will be set (e.g. pyscript).

raises a ValueError if neither a port nor a board can be found

Parameters:

manifest_path (pathlib.Path)

Return type:

Tuple[str, str, str]

stubber.freeze.common.get_freeze_path(stub_path: pathlib.Path, port: str, board: str, variant: str = '') Tuple[pathlib.Path, str]

get path to a folder to store the frozen stubs for the given port/board/variant.

For stand-alone ports (no boards/ folder) the variant is used as the folder name (e.g. webassembly/PYSCRIPT). When neither board nor variant is provided for a stand-alone port, the default variant name standard is used instead of the legacy GENERIC placeholder.

Parameters:
Return type:

Tuple[pathlib.Path, str]

stubber.freeze.common.apply_frozen_module_fixes(freeze_path: pathlib.Path, mpy_path: pathlib.Path)

apply common fixes to the fozen modules to improve stub generation

Parameters: