repolite.repolite module
Manage a small set of repository dependencies without manifest.xml or git submodules. You get to write (local) project config files in yaml instead.
- repolite.repolite.check_for_git()[source]
Make sure we can find the
git
andgit-lfs
binaries in the user environment and return a tuple of path strings.- Return git_path, lfs_path:
program path strings
- Rtype tuple:
path to program if found, else None
- repolite.repolite.check_repo_state(ucfg)[source]
Check if repo configuration is consistent, ie, does current repo state match repo configuration items. Return
True
if current directories match the configuration, elseFalse
.- Parameters:
ucfg (Munch cfgobj) – Munch configuration object extracted from config file
- Return is_state_valid:
Boolean
- repolite.repolite.check_repo_url(url)[source]
Make sure the url is sanitary on most platforms.
- Parameters:
url – input url / path from pathlib or config
- Return url:
url / path to clone
- Rtype str:
- repolite.repolite.create_locked_cfg(ucfg, ufile, quiet, test=None)[source]
Create a ‘locked’ cfg file, ie, read the active config file and populate the
repo_hash
values with HEAD from each branch, then write a new config file with ‘-locked’ appended to the name.- Parameters:
ucfg (Munch cfgobj) – Munch configuration object extracted from config file
ufile (Path obj) – active config file
quiet (Boolean) – Suppress some git output
test (str or None) – test path for locked config file
- Raises:
DirectoryTypeError – if repo state is invalid
- repolite.repolite.create_repo_tags(ucfg, utag, test=None)[source]
Create a new signed or annotated tag in each configured repository. (re)Set the gpg signing key from user config.
- Parameters:
ucfg (Munch cfgobj) – Munch configuration object extracted from config file
utag (str obj) – tag string to apply
test (str or None) – test path for config file
- Raises:
DirectoryTypeError – if repo state is invalid
- repolite.repolite.generate_change_data(mrepo, base_tag, dir_name, cur_tag)[source]
Generate a changelog (full or diff) for the given repository and drop it in the configured top_dir directory. Checks repo config for base tag to decide full vs diff.
- Parameters:
mrepo (Munch obj) – a Munch repo obj with Munch repos item
base_tag (str or None) – starting tag for change diff
cur_tag (str) – ending tag for change diff (tag on current commit)
- Dir_name:
directory name for output (top_dir)
- repolite.repolite.install_with_pip(pip_name, quiet=False)[source]
Install a python repository via pip; this should be done in a local virtual environment.
- Parameters:
pip_name (str) – path to directory name of python repo to install
quiet (boolean) – filter most of the install cmd output
- repolite.repolite.load_config(file_encoding='utf-8')[source]
Load yaml configuration file and munchify the data. If ENV path or local file is not found in current directory, the default will be loaded.
- Parameters:
file_encoding (str) – file encoding of config file
- Return tuple:
Munch cfg obj and cfg file as Path obj
- Raises:
FileTypeError – if the input file is not yml
- repolite.repolite.parse_config(ucfg)[source]
Parse config file options and build list of repo objects. Return list of global options and list of Munch repo objects.
- Parameters:
ucfg (Munch cfgobj) – Munch configuration object extracted from config file
- Return tuple:
list of flags, list of repository objs
- repolite.repolite.process_git_repos(flags, repos, pull, quiet)[source]
Process list of git repository objs and populate/update
top_dir
.- Parameters:
flags (list) – List of options (from yaml cfg)
repos (list) – List of repository objs (from yaml cfg)
pull (Boolean) – Update if True, else checkout
quiet (Boolean) – Suppress some git output
- Raises:
FileExistsError – if cloning on top of existing directories
- repolite.repolite.process_repo_changes(ucfg)[source]
Generate a changelog for any repos with the
repo_gen_changes
flag set. Note we do not check repo state here, we just process each valid repo entry.- Parameters:
ucfg (Munch cfgobj) – Munch configuration object extracted from config file
quiet – pass the
quiet
cmd line flag to install cmd
- repolite.repolite.process_repo_install(ucfg, quiet)[source]
Install any repos with the
repo_install
flag set. Note we do not check repo state here, we just process each valid repo entry.- Parameters:
ucfg (Munch cfgobj) – Munch configuration object extracted from config file
quiet – pass the
quiet
cmd line flag to install cmd
- repolite.repolite.resolve_top_dir(upath)[source]
Resolve top_dir, ie, containing directory for git repositories. The suggested path is inside the project working directory, but we should support any writable path. Also set the working dir path and return both as Path objs.
- Return workpath, userpath:
tuple of Path objs