stubber.utils.repos

utility functions to handle to cloned repos needed for stubbing.

Module Contents

Functions

switch(tag, *, mpy_path, mpy_lib_path)

Switch to a specific version of the micropython repos.

read_micropython_lib_commits([filename])

Read a csv with the micropython version and matching micropython-lib commit-hashes

match_lib_with_mpy(→ bool)

fetch_repos(tag, mpy_path, mpy_lib_path)

Fetch updates, then switch to the provided tag

repo_paths(→ Tuple[pathlib.Path, pathlib.Path])

Return the paths to the micropython and micropython-lib repos, given a path to the repos.'

stubber.utils.repos.switch(tag: str, *, mpy_path: pathlib.Path, mpy_lib_path: pathlib.Path)

Switch to a specific version of the micropython repos.

Specify the version with –tag or –version to specify the version tag of the MicroPython repo. The Micropython-lib repo will be checked out to a commit that corresponds in time to that version tag, in order to allow non-current versions to be stubbed correctly.

The repros must be cloned already

Parameters:
stubber.utils.repos.read_micropython_lib_commits(filename: str = 'data/micropython_tags.csv')

Read a csv with the micropython version and matching micropython-lib commit-hashes these can be used to make sure that the correct micropython-lib version is checked out.

filename is relative to the ‘stubber’ package

git for-each-ref –sort=creatordate –format ‘%(refname) %(creatordate)’ refs/tags

Parameters:

filename (str) –

stubber.utils.repos.match_lib_with_mpy(version_tag: str, mpy_path: pathlib.Path, lib_path: pathlib.Path) bool
Parameters:
Return type:

bool

stubber.utils.repos.fetch_repos(tag: str, mpy_path: pathlib.Path, mpy_lib_path: pathlib.Path)

Fetch updates, then switch to the provided tag

Parameters:
stubber.utils.repos.repo_paths(dest_path: pathlib.Path) Tuple[pathlib.Path, pathlib.Path]

Return the paths to the micropython and micropython-lib repos, given a path to the repos.’

Parameters:

dest_path (pathlib.Path) –

Return type:

Tuple[pathlib.Path, pathlib.Path]