Library¶
Constants.
- livecheck.constants.RSS_NS¶
Namespace for RSS feeds.
- livecheck.constants.SUBMODULES : Mapping[str, set[str | tuple[str, str] | tuple[str, str, str]]]¶
Currently, submodule handling is hard-coded for specific packages.
- livecheck.constants.TAG_NAME_FUNCTIONS : Mapping[str, Callable[[str], str]]¶
Functions to prefix tag names for specific packages.
Utility functions.
-
class livecheck.utils.TextDataResponse(text: str, status_code: int =
HTTPStatus.OK)¶ Used for data URI responses.
- livecheck.utils.assert_not_none(x: T | None) T¶
Assert that the value is not None.
- Returns:¶
The same value when it is not
None.- Return type:¶
T
- Raises:¶
AssertionError – If
xisNone.
-
livecheck.utils.check_program(cmd: str, args: Iterable[str] | None =
None, min_version: str | None =None) bool¶ Check if a program is installed.
Optionally check if the installed version is at least the specified minimum version.
- livecheck.utils.extract_sha(text: str) str¶
Extract the first valid SHA-1 hash (7 or 40 characters) found in the given string.
-
async livecheck.utils.get_content(url: str, headers: Mapping[str, str] | None =
None, params: Mapping[str, str] | None =None, method: str ='GET', data: Mapping[str, str] | None =None, *, allow_redirects: bool =True) niquests.Response¶ Fetch content from a URL.
- Parameters:¶
- url : str¶
URL to request.
- headers : Mapping[str, str] | None¶
Optional extra HTTP headers.
- params : Mapping[str, str] | None¶
Optional query string parameters.
- method : str¶
HTTP method name (for example
GET).- data : Mapping[str, str] | None¶
Optional form body for the request.
- allow_redirects : bool¶
Whether to follow redirects.
- Returns:¶
Response object, or a synthetic response on failure or unimplemented schemes.
- Return type:¶
-
async livecheck.utils.get_last_modified(url: str, headers: Mapping[str, str] | None =
None, params: Mapping[str, str] | None =None) str¶ Get the last modified date of a URL.
-
async livecheck.utils.hash_url(url: str, headers: Mapping[str, str] | None =
None, params: Mapping[str, str] | None =None) tuple[str, str, int]¶ Hash the content of a URL using BLAKE2b and SHA-512.
- livecheck.utils.init_sessions(semaphore: asyncio.Semaphore) None¶
Initialise the module-level HTTP semaphore and clear the session cache.
Must be called once at the start of the async entry point before any HTTP requests.
- Parameters:¶
- semaphore : asyncio.Semaphore¶
Shared semaphore bounding concurrent in-flight HTTP requests.
- livecheck.utils.is_sha(url: str) 40 | 7 | 0¶
Extract the last part of a URL and checks if it is a valid SHA-1 hash.
- livecheck.utils.session_init(module: str) AsyncSession¶
Get or create a cached HTTP session for the given module.
- Parameters:¶
- Returns:¶
Configured HTTP session with caching and concurrency limiting.
- Return type:¶
- Raises:¶
RuntimeError – If
init_sessions()has not been called.
Portage utilities.
- livecheck.utils.portage.P¶
Portage tree database API instance.
- livecheck.utils.portage.catpkg_catpkgsplit(atom: str) tuple[str, str, str, str]¶
Split an atom string into category, package, and version, but also return CP.
- livecheck.utils.portage.catpkgsplit2(atom: str) tuple[str | None, str, str, str]¶
Split an atom string. This function always returns a four-string tuple.
- livecheck.utils.portage.compare_versions(old: str, new: str) bool¶
Compare two version strings using Portage’s
vercmp().
- livecheck.utils.portage.fetch_ebuild(ebuild_path: str) bool¶
Perform
ebuild fetchoperation.
-
async livecheck.utils.portage.get_aux(match: str, keys: Iterable[_AuxKey], mytree: str | None =
None) list[str]¶ Get ebuild metadata values via
P.async_aux_get().
- livecheck.utils.portage.get_distdir() Path¶
Get the
DISTDIRpath from Portage settings.Falls back to default
/var/cache/distfiles.
- async livecheck.utils.portage.get_fetch_map(cpv: str) dict[str, tuple[str, ...]]¶
Get the
SRC_URIfetch map viaP.async_fetch_map().
-
async livecheck.utils.portage.get_first_src_uri(match: str, search_dir: Path | None =
None) str¶ Get the first source URI for a match string.
- async livecheck.utils.portage.get_highest_matches(names: Iterable[str], repo_root: Path | None, settings: LivecheckSettings) list[str]¶
Get the highest matching versions for an iterable of package names.
-
livecheck.utils.portage.get_last_version(results: Collection[Mapping[str, str]], repo: str, ebuild: str, settings: LivecheckSettings, version_reference: str =
'') dict[str, str]¶ Get the latest version from the results.
- Parameters:¶
- results : Collection[Mapping[str, str]]¶
Collection of result mappings containing version information.
- repo : str¶
Repository name.
- ebuild : str¶
Ebuild atom string.
- settings : LivecheckSettings¶
Livecheck settings instance.
- version_reference : str¶
Current upstream tag or filename whose versioned pattern candidates must match.
- Returns:¶
Dictionary with the latest version information, or an empty dictionary if no update found.
- Return type:¶
- livecheck.utils.portage.get_repository_root_if_inside(directory: Path) tuple[str, str]¶
Get the repository root if the current working directory is inside a repository.
- livecheck.utils.portage.remove_leading_zeros(ver: str) str¶
Remove leading zeros from date-like version components.
- livecheck.utils.portage.unpack_ebuild(ebuild_path: str) str¶
Perform
ebuild unpackoperation and return theWORKDIRpath.
Settings¶
Settings.
- class livecheck.settings.LivecheckSettings(branches: dict[str, str] = <factory>, custom_livechecks: dict[str, tuple[str, str]] = <factory>, dotnet_packages: dict[str, bool] = <factory>, dotnet_projects: dict[str, str] = <factory>, dist_github_repositories: dict[str, str] = <factory>, dist_github_releases: dict[str, str] = <factory>, go_sum_uri: dict[str, str] = <factory>, type_packages: dict[str, str] = <factory>, no_auto_update: set[str] = <factory>, sha_sources: dict[str, str] = <factory>, transformations: Mapping[str, Callable[[str], str]] = <factory>, yarn_base_packages: dict[str, str] = <factory>, yarn_packages: dict[str, set[str]] = <factory>, jetbrains_packages: dict[str, bool] = <factory>, keep_old: dict[str, bool] = <factory>, gomodule_packages: dict[str, bool] = <factory>, gomodule_path: dict[str, str] = <factory>, nodejs_packages: dict[str, bool] = <factory>, nodejs_path: dict[str, str] = <factory>, nodejs_package_managers: dict[str, str] = <factory>, development: dict[str, bool] = <factory>, composer_packages: dict[str, bool] = <factory>, composer_path: dict[str, str] = <factory>, maven_packages: dict[str, bool] = <factory>, maven_path: dict[str, str] = <factory>, regex_version: dict[str, tuple[str, str]] = <factory>, restrict_version: dict[str, str] = <factory>, sync_version: dict[str, str] = <factory>, stable_version: dict[str, str] = <factory>, request_headers: dict[str, dict[str, str]] = <factory>, request_params: dict[str, dict[str, str]] = <factory>, request_method: dict[str, str] = <factory>, request_data: dict[str, dict[str, str]] = <factory>, regex_multiline: dict[str, bool] = <factory>, auto_update_flag: bool = False, debug_flag: bool = False, development_flag: bool = False, git_flag: bool = False, keep_old_flag: bool = False, progress_flag: bool = False, default_package_manager: str = 'npm', dist_github_repository: str = '', dist_github_release: str = '', dist_force_upload_flag: bool = False, restrict_version_process: str = '')¶
All settings.
-
dist_force_upload_flag : bool =
False¶ Force re-upload even when an asset with the same name already exists.
-
dist_github_release : str =
''¶ Global release tag for dist archive uploads (from
--dist-github-release).
- dist_github_releases : dict[str, str]¶
Dictionary of catpkg to release tag override for dist archive uploads.
- dist_github_repositories : dict[str, str]¶
Dictionary of catpkg to
owner/repooverride for dist archive uploads.
-
dist_github_repository : str =
''¶ Global
owner/repofor dist archive uploads (from--dist-github-repository).
- dist_settings_for(catpkg: str) DistGitHubSettings | None¶
Resolve GitHub dist upload settings for a package.
- dotnet_packages : dict[str, bool]¶
Dictionary of catpkg to whether a NuGet packages vendor archive should be built.
- dotnet_projects : dict[str, str]¶
Dictionary of catpkg to project or solution file (base name only).
- go_sum_uri : dict[str, str]¶
Dictionary of catpkg to full URI to
go.sumwith@PV@used for where version gets placed.
-
dist_force_upload_flag : bool =
- livecheck.settings.gather_settings(search_dir: Path) LivecheckSettings¶
Gather settings from
livecheck.jsonfiles in the given directory.
Typing¶
Typing helpers.
- livecheck.typing.PropTuple¶
A tuple for properties category, PN, PV, last version, top hash, hash date, and URL.
-
livecheck.typing.Response =
livecheck.utils.requests.TextDataResponse | niquests.models.Response¶ Special response type.