livery.extensions.conan._package¶
livery.extensions.conan._package ¶
A conan package's recipe, its build into the conan cache, and its release.
The recipe, conanfile.py, declares the version and the
requirements. conan create builds the package into the conan
cache. A release saves the cache per host and uploads it to a conan
remote, or attaches it to the member's release on a forge that hosts no
conan registry, and a consumer restores it from there. The workspace's
conan members resolve one another from their sources through the conan
workspace file at the root (WORKSPACE_FILE), the fragment this
extension declares.
Classes:
| Name | Description |
|---|---|
ConanRegistry |
The wave's probe against a conan target; fits the Registry seam. |
Functions:
| Name | Description |
|---|---|
conan_requirements |
The conan references a recipe declares, name to version text. |
declare_requirement |
Add |
declared_requirements |
The conan references the package's recipe declares. |
current_version |
The version the recipe's |
names_a_reference |
Whether package's recipe declares both |
is_conan_package |
Whether member holds conan and its recipe names a reference. |
raise_floors |
Raise each requirement on a member released with package; the files changed. |
stamp_version |
Where a conan package's version lives, ready to stamp. |
cache_name |
The saved-cache file name for name at version on host. |
workspace_file |
The conan workspace file for root: each conan member, from its source. |
workspace_aside |
Hide root's conan workspace for the block, so members resolve from the cache. |
save_cache |
Save this host's built package out of the conan cache; the file. |
restore_cache |
Restore the package a saved cache file holds into the conan cache. |
collected_caches |
The saved caches in package's |
restore_collected |
Restore every saved cache the run collected for version into the conan cache. |
publish_artifact |
Publish the package to the resolved target: conan's publish step calls it. |
changelog_entry |
The changelog section for version; empty when there is none. |
publish_to_releases |
Attach every host's saved cache to the member's own release. |
publish |
Upload the recipe to the resolved target; False when already there. |
member_path |
The workspace path of the member named name; empty when none is. |
restore_from_releases |
Restore name at version from its release into the conan cache. |
verify_digest |
Check data against the forge's digest; a mismatch refuses. |
profile_path |
Conan's default profile file: under |
profile_names_compiler |
Whether the profile file at path names a compiler under |
ensure_profile |
Make conan's default profile name a compiler; a line when it was replaced. |
build |
Package package through |
Attributes:
| Name | Type | Description |
|---|---|---|
TEMP_VARIABLES |
|
|
CONAN_REMOTE |
|
|
CACHE_NAME |
|
|
RECIPE_FILE |
|
|
WORKSPACE_FILE |
|
|
EXTENSION |
|
|
TOKEN_USER |
|
ConanRegistry ¶
ConanRegistry(target: RegistryTarget, *, root: Path)
The wave's probe against a conan target; fits the Registry seam.
Three routes, matching the publisher's: the forge's releases
answer from each member's release assets, a remote answers from
conan list, and a folder answers from the saved tarball
names in the directory.
Methods:
| Name | Description |
|---|---|
versions |
The published versions of name at the target. |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
versions ¶
The published versions of name at the target.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
conan_requirements ¶
The conan references a recipe declares, name to version text.
Reads the requires class attribute (a string or a tuple) and
self.requires("...") calls, without importing conan: the
recipe is parsed as source. "acme-native/[>=0.1.0]" answers
{"acme-native": "[>=0.1.0]"}.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
declare_requirement ¶
Add <dependency>/[>=<floor>] to the recipe's requires; the files changed.
The conan extension's requirement writer, its answer to the
requirement-writers query. It takes a sibling that is a conan
package (is_conan_package), and returns None for any other
sibling, which it leaves to another writer of the package's set.
The reference joins the recipe's requires tuple as text, so the
recipe's own layout stays, and a recipe that declares no
requirement gets the tuple, among the attributes of its recipe
class. A recipe that declares its requirements another way
(self.requires calls, a single string) refuses naming the line
to add, rather than guessing where a method body wants it. Already
declared means nothing to write.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
declared_requirements ¶
The conan references the package's recipe declares.
The layering lint compares these against the contract's
[[depends]] edges; a package without a conanfile declares
nothing.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
current_version ¶
The version the recipe's version attribute declares.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
names_a_reference ¶
Whether package's recipe declares both name and version.
A recipe that does is a conan package, which the workspace resolves from its source; one that declares neither, a consumer's recipe with requirements alone, is what conan installs for, never a workspace package.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
is_conan_package ¶
Whether member holds conan and its recipe names a reference.
Such a member is a conan package: the conan workspace resolves it from its source, and a sibling's recipe requires it by its reference. A member that holds conan through a consumer's recipe, one that names no reference, is not one.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
raise_floors ¶
Raise each requirement on a member released with package; the files changed.
floors names each such member by its path, to the version it
releases at. A reference to that member in the recipe in the range
form a requirement writer writes, "<name>/[>=<floor>]", takes
that version, in a recipe that names a reference and in a
consumer's alike. Empty for no floors, for a package with no
recipe, and for a recipe that names none of them.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
cache_name ¶
The saved-cache file name for name at version on host.
host defaults to the machine running this, as the store keys hosts.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
workspace_file ¶
The conan workspace file for root: each conan member, from its source.
The fragment this extension declares: the workshop writes it at the root while a package's set holds conan and withdraws it with the last package that did. A package that lists conan, or an extension that requires it, holds it (livery.workshop.extension_set). The members are listed in path order.
Conan finds the file by walking up from the directory a command
runs in, so a command inside the workspace resolves each member
from its source tree, and one outside resolves it from the cache
or a remote. Nothing is registered in the conan home, so a
workspace leaves nothing behind, and each checkout of a repository
resolves to its own sources. An entry names its member by path
alone: conan reads the reference from the recipe's name and
version, so the file stays right when a release stamps the
version.
A member whose recipe names no reference is left out: conan
deduces a workspace package's reference from the recipe's name
and version, and a consumer's recipe, requirements alone, is
what conan installs for, never a workspace package.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
The workspace root, whose members the file lists. |
required |
absolute
|
bool
|
Whether each entry is the member's absolute POSIX path, for a copy placed outside the root: a Linux build container mounts the root at its host path and reads such a copy beside the package it builds. False writes the paths relative to the root, for the file the root holds. |
False
|
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
workspace_aside ¶
Hide root's conan workspace for the block, so members resolve from the cache.
A release leg builds what the release ships: a member's
conan create and an extension's wheel resolve a sibling to the
package the leg created, never to its source tree. Conan finds the
workspace from the directory a command runs in and has no switch
to ignore it, so the file moves aside for the block and comes back
after it, a failure included. A leg killed inside the block leaves
the file aside, and the next sync writes it again.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
save_cache ¶
Save this host's built package out of the conan cache; the file.
The release matrix runs one leg per wheel platform: each leg
creates the package for its own host and saves it here, the
collection gathers every leg's file, and the wave attaches them
all to the member's release. conan cache restore reads one
back on any machine.
Raises:
| Type | Description |
|---|---|
Failed
|
when conan refuses the save; the message carries its output. |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
restore_cache ¶
Restore the package a saved cache file holds into the conan cache.
conan cache restore reads archive, a file save_cache wrote
on any machine, and puts its package where a build resolves it and
an upload reads it. Conan runs in cwd.
Raises:
| Type | Description |
|---|---|
Failed
|
when conan refuses the restore; the message carries its output. |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
collected_caches ¶
The saved caches in package's dist/ for version, in name order.
One file per host. A saved cache is the file save_cache names for
a host the store knows, <name>-<version>-<host>.tgz, so a file
for another version is never among them. Both routes that ship the collected
caches read this: the releases route attaches them, and the folder
and remote routes restore them before the upload.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
restore_collected ¶
Restore every saved cache the run collected for version into the conan cache.
A job of the release creates the package on each of its legs and
saves it per host (save_cache), and the publish job collects every
leg's file into dist/. The publish job's conan cache is its own
and starts without the package. Each host's file is restored, in
name order, so the upload, which reads that cache, sends every
host's binary the run collected: the same hosts the releases route
attaches (collected_caches). A file for another version is not
restored.
Raises:
| Type | Description |
|---|---|
Failed
|
when |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
publish_artifact ¶
publish_artifact(package: Package, root: Path, *, version: str, target: RegistryTarget, prebuilt: bool = False) -> bool
Publish the package to the resolved target: conan's publish step calls it.
Three routes, by what the ladder resolved: the forge's own
releases, a folder, or a conan remote. On the remote route conan
logs in with the target's token, the forge lane's token for a
forge's own registry, unless conan's own variables are set
(publish).
prebuilt says a job of the run built the package and the run
collected the saved caches into dist/, so this job built
nothing. The folder and remote routes read the conan cache, and
restore every host's file into it first (restore_collected), so
the upload sends every host's binary the run collected. The
releases route attaches the same files themselves and restores
nothing.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
changelog_entry ¶
The changelog section for version; empty when there is none.
The body of the release the caches ride on, so a person reading the release page sees what changed, not a bare tag.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
publish_to_releases ¶
Attach every host's saved cache to the member's own release.
The route for a forge that hosts no conan registry: the release of the receipt tag is the package's address, and its assets are the per-host caches the matrix legs saved. Idempotent in both halves: an existing release is used, and an asset already attached is walked past, so a re-run after a half-finished wave completes it.
Returns:
| Type | Description |
|---|---|
bool
|
True when this call attached anything; False when the |
bool
|
release already carried every cache. |
Raises:
| Type | Description |
|---|---|
Failed
|
when |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
publish ¶
Upload the recipe to the resolved target; False when already there.
A remote target gets conan upload through the workshop
remote (re-pointed at target_url first, so the name never
drifts). A folder target gets conan cache save: the saved
tarball lands as <dir>/<name>-<version>.tgz, and
conan cache restore reads it back on any machine.
The upload logs in with token when conan's own variables are
unset: CONAN_LOGIN_USERNAME and CONAN_PASSWORD, or the
pair scoped to the workshop remote. Set, they win. With
neither, the upload is anonymous, and the refusal teaches the
variables when the remote wants a login.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
member_path ¶
The workspace path of the member named name; empty when none is.
Names the member whose releases carry a conan package, so a consumer turns a requirement's name into the tag that holds it.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
restore_from_releases ¶
Restore name at version from its release into the conan cache.
The consumer's half of the releases route: the member's release
is read for this host's saved cache, the bytes are checked
against the digest the forge reports, and conan cache
restore puts the package where a build resolves it.
Raises:
| Type | Description |
|---|---|
Failed
|
when the member is unknown here, the release carries no cache for this host, or the bytes do not match the digest. |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
verify_digest ¶
Check data against the forge's digest; a mismatch refuses.
An empty digest is a forge that reports none: the bytes are used and the line says they were not checked, which is the honest state rather than a silent pass.
Raises:
| Type | Description |
|---|---|
Failed
|
when the digest is a sha256 the bytes do not match, or names an algorithm this does not know. |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
profile_path ¶
Conan's default profile file: under CONAN_HOME, else ~/.conan2.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
profile_names_compiler ¶
Whether the profile file at path names a compiler under [settings] itself.
A plain read, no process: the answer a sync wants on every job
whose profile is already detected. False when the file is not
there or names no compiler in its own lines; an include may
name one, and conan is asked then.
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
ensure_profile ¶
Make conan's default profile name a compiler; a line when it was replaced.
conan create refuses a profile that names no compiler. The
cmake-conan provider writes the default profile itself when there
is none, from inside CMake's configure, where conan's detection
finds no compiler, and every later conan call keeps that profile.
So a missing profile is detected here before anything configures,
and one that names no compiler is detected again, which replaces
it. A profile that names a compiler is kept as it is, and when its
file says so no conan process starts: this runs before every
install, on every job. Calls in one process take turns, so no two
detections run at once, and a call that waited finds the profile
the one before it made.
Returns:
| Type | Description |
|---|---|
list[str]
|
The line saying the profile was detected again; empty when it |
list[str]
|
named a compiler already, or was missing and is detected now. |
Raises:
| Type | Description |
|---|---|
Failed
|
when conan cannot detect or show the profile, in its own words, or when detection finds no compiler here. |
Source code in packages/extensions/conan/src/livery/extensions/conan/_package.py
build ¶
Package package through conan create; the conan cache dir.
conan create exports the recipe, builds in the cache, and
packages the result there; publishing uploads from the cache, so
nothing lands in a dist/ directory. Conan's default profile is
made to name a compiler first (ensure_profile). Returns the
package's build directory, for the caller to inspect. Every
backend's build takes epoch; conan writes its own metadata, so
this one does not read it.