stubber.utils.repos¶
utility functions to handle to cloned repos needed for stubbing.
Functions¶
|
Switch to a specific version of the micropython repos. |
|
Read a csv with the micropython version and matching micropython-lib commit-hashes |
|
make sure any submodules are in sync |
|
Checkout the arduino-lib submodule repo if it exists |
|
|
|
Fetch updates, then switch to the provided tag/branch/commit |
|
Return the paths to the micropython and micropython-lib repos, given a path to the repos.' |
Module Contents¶
- 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:
tag (str)
mpy_path (pathlib.Path)
mpy_lib_path (pathlib.Path)
- 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.sync_submodules(repo: pathlib.Path | str) bool¶
make sure any submodules are in sync
- Parameters:
repo (Union[pathlib.Path, str])
- Return type:
- stubber.utils.repos.checkout_arduino_lib(mpy_path: pathlib.Path)¶
Checkout the arduino-lib submodule repo if it exists
This is needed as some of the arduino boards freeze modules originationg from the arduino-lib
- Parameters:
mpy_path (pathlib.Path)
- stubber.utils.repos.match_lib_with_mpy(version_tag: str, mpy_path: pathlib.Path, lib_path: pathlib.Path) bool¶
- Parameters:
version_tag (str)
mpy_path (pathlib.Path)
lib_path (pathlib.Path)
- Return type:
- stubber.utils.repos.fetch_repos(tag: str, mpy_path: pathlib.Path, mpy_lib_path: pathlib.Path)¶
Fetch updates, then switch to the provided tag/branch/commit
- Parameters:
tag (str)
mpy_path (pathlib.Path)
mpy_lib_path (pathlib.Path)
- 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]