Skip to content

livery.extensions.conan._steps

livery.extensions.conan._steps

The conan extension's steps in a package's lifecycle phases.

Functions:

Name Description
profile

Make conan's default profile name a compiler before a build runs through it.

stamp

Write the engine's version into the recipe and raise its floors there.

build

Build the package into the conan cache; its build directory.

publish

Upload the package to the registry target the engine resolved.

profile

profile(ctx: PhaseContext) -> None

Make conan's default profile name a compiler before a build runs through it.

The cmake-conan provider writes a default profile itself when there is none, with no compiler in it, so a profile detected first is the one the provider finds. Prints what was done, nothing when the profile already names a compiler.

Source code in packages/extensions/conan/src/livery/extensions/conan/_steps.py
def profile(ctx: PhaseContext) -> None:
    """Make conan's default profile name a compiler before a build runs through it.

    The cmake-conan provider writes a default profile itself when there
    is none, with no compiler in it, so a profile detected first is the
    one the provider finds. Prints what was done, nothing when the
    profile already names a compiler.
    """
    for line in _package.ensure_profile(ctx.root):
        print(line)

stamp

stamp(ctx: PhaseContext) -> None

Write the engine's version into the recipe and raise its floors there.

The version goes into the recipe's version attribute; each requirement on one of the engine's floors, a member released with this one, takes that member's version.

Source code in packages/extensions/conan/src/livery/extensions/conan/_steps.py
def stamp(ctx: PhaseContext) -> None:
    """Write the engine's version into the recipe and raise its floors there.

    The version goes into the recipe's ``version`` attribute; each
    requirement on one of the engine's floors, a member released with
    this one, takes that member's version.
    """
    version = cast("str", ctx.read("version"))
    floors = cast("Mapping[str, str]", ctx.read("floors"))
    changed = _package.stamp_version(ctx.member).stamp(version)
    changed += _package.raise_floors(ctx.member, floors)
    ctx.provide("changed", list(dict.fromkeys(changed)))

build

build(ctx: PhaseContext) -> None

Build the package into the conan cache; its build directory.

Conan writes its own metadata, so the step reads no epoch.

Source code in packages/extensions/conan/src/livery/extensions/conan/_steps.py
def build(ctx: PhaseContext) -> None:
    """Build the package into the conan cache; its ``build`` directory.

    Conan writes its own metadata, so the step reads no epoch.
    """
    ctx.provide("dist", _package.build(ctx.member, ctx.root))

publish

publish(ctx: PhaseContext) -> None

Upload the package to the registry target the engine resolved.

A package a job of the run built, which the engine gives as prebuilt, is restored into this job's conan cache from every host's file the run collected before the upload reads it, so the upload sends every host's binary.

Source code in packages/extensions/conan/src/livery/extensions/conan/_steps.py
def publish(ctx: PhaseContext) -> None:
    """Upload the package to the registry target the engine resolved.

    A package a job of the run built, which the engine gives as
    ``prebuilt``, is restored into this job's conan cache from every
    host's file the run collected before the upload reads it, so the
    upload sends every host's binary.
    """
    from livery.workshop import RegistryTarget

    version = cast("str", ctx.read("version"))
    target = RegistryTarget.from_table(
        cast("Mapping[str, object]", ctx.read("registry-target"))
    )
    published = _package.publish_artifact(
        ctx.member,
        ctx.root,
        version=version,
        target=target,
        prebuilt=cast("bool", ctx.read("prebuilt")),
    )
    ctx.provide("published", published)