httk.core.building¶
Provide generalized build vocabulary and execution for httk manifests.
Attributes¶
Exceptions¶
Describe a build failure with its protocol code. |
Classes¶
Describe a build command and its disposable artifacts. |
|
Describe the result of executing a build. |
Functions¶
|
Read and validate the optional build table in a manifest. |
|
Return a predicate for declared artifacts and their descendants. |
|
Probe and tag the current platform. |
|
Execute a build and collect its declared artifacts. |
|
Copy build artifacts into an atomically registered generation. |
|
Return registered artifacts when the build stamp still matches. |
|
Copy registered artifact files over a staged tree. |
Module Contents¶
- class httk.core.building.BuildSpec[source]¶
Describe a build command and its disposable artifacts.
- Parameters:
command – Supply the build command.
artifacts – Name artifact patterns to exclude from source publication.
platform – Restrict the build to a platform, when supplied.
- exception httk.core.building.BuildError(code, message)[source]¶
Bases:
ValueErrorDescribe a build failure with its protocol code.
- class httk.core.building.BuildResult[source]¶
Describe the result of executing a build.
- Parameters:
tag – Identify the platform registration tag.
platform_output – Preserve the raw platform probe output.
artifact_files – Name the collected artifact files as relative POSIX paths.
- httk.core.building.read_manifest_build_spec(root, *, manifest_name, table_name, protected_names)[source]¶
Read and validate the optional build table in a manifest.
- Parameters:
root (pathlib.Path) – Locate the manifest directory.
manifest_name (str) – Name the manifest file.
table_name (str) – Name the top-level manifest table.
protected_names (collections.abc.Sequence[str]) – Name members artifact patterns must preserve.
- Returns:
The build specification, or
Nonewhen absent.- Raises:
ValueError – If the manifest or build table is malformed.
- Return type:
BuildSpec | None
- httk.core.building.artifact_excluder(spec)[source]¶
Return a predicate for declared artifacts and their descendants.
- Parameters:
spec (BuildSpec | None) – Supply the build specification, when present.
- Returns:
A predicate accepting relative POSIX paths.
- Return type:
- httk.core.building.platform_tag(platform_command, *, env=None)[source]¶
Probe and tag the current platform.
- Parameters:
platform_command (str | None) – Supply the platform probe command, when present.
env (collections.abc.Mapping[str, str] | None) – Supply the probe environment, or inherit the current environment.
- Returns:
The sanitized tag and the probe’s raw standard output.
- Raises:
BuildError – If the platform probe cannot be run successfully.
- Return type:
- httk.core.building.execute_build(source, spec, *, strip_env_prefixes, keep_env=(), log_path=None, stdout_to_stderr=False)[source]¶
Execute a build and collect its declared artifacts.
- Parameters:
source (pathlib.Path) – Run the build from this source directory.
spec (BuildSpec) – Describe the build command and artifact patterns.
strip_env_prefixes (collections.abc.Sequence[str]) – Remove environment variables with these prefixes.
keep_env (collections.abc.Sequence[str]) – Preserve these variable names despite their prefixes.
log_path (pathlib.Path | None) – Optionally write build metadata at this path.
stdout_to_stderr (bool) – Route inherited build standard output to standard error.
- Returns:
The platform tag, probe output, and collected artifact paths.
- Raises:
BuildError – If probing, execution, or artifact collection fails.
- Return type:
- httk.core.building.write_generation(builds_root, relative, tag, source, artifact_files, stamp)[source]¶
Copy build artifacts into an atomically registered generation.
- Parameters:
builds_root (pathlib.Path) – Locate the build registration store.
relative (str) – Identify the source registration relative to the store.
tag (str) – Identify the platform registration.
source (pathlib.Path) – Locate the built source tree.
artifact_files (collections.abc.Sequence[str]) – Name relative POSIX artifact files to copy.
stamp (collections.abc.Mapping[str, object]) – Supply the build stamp fields.
- Returns:
The new generation directory.
- Return type:
- httk.core.building.registered_generation(builds_root, relative, tag, *, format_name, expected_source_sha256)[source]¶
Return registered artifacts when the build stamp still matches.
- Parameters:
builds_root (pathlib.Path) – Locate the build registration store.
relative (str) – Identify the source registration relative to the store.
tag (str) – Identify the platform registration.
format_name (str) – Require this build stamp format name.
expected_source_sha256 (str | None) – Require this source digest when supplied.
- Returns:
The registered artifact directory, or
Nonewhen unusable.- Return type:
pathlib.Path | None
- httk.core.building.overlay_artifacts(artifacts_dir, target)[source]¶
Copy registered artifact files over a staged tree.
- Parameters:
artifacts_dir (pathlib.Path) – Locate the registered artifact tree.
target (pathlib.Path) – Locate the staged tree to overlay.