anod.store.buildinfo

Build information management for Anod store.

Module Contents

Classes

BuildInfo

BuildInfo structure.

Attributes

BuildInfoType

logger

anod.store.buildinfo.BuildInfoType
anod.store.buildinfo.logger
class anod.store.buildinfo.BuildInfo(build_date: str, setup: str, creation_date: str, id: str, build_version: str, isready: bool, store: e3.anod.store.interface.StoreReadInterface | e3.anod.store.interface.StoreRWInterface | None = None)

BuildInfo structure.

Variables:
  • build_date (str) – The build date.

  • setup (str) – The build setup.

  • creation_date (str) – The build’s creation date.

  • id (str) – The build’s ID.

  • build_version (str) – The build version. ??? Deserve a better description.

  • isready (bool) – True if the build is complete and ready to be downloaded. False otherwise.

__hash__
classmethod load(data: BuildInfoDict, store: e3.anod.store.interface.StoreReadInterface | e3.anod.store.interface.StoreRWInterface | None = None) typing_extensions.Self

Create a BuildInfo from the result of a Store build info request.

Parameters:
  • data – dictionary returned by Store after a build info request

  • store – a Store instance

Returns:

a BuildInfo instance

__str__() str

Convert a buildinfo to a str.

__eq__(other: object) bool

Compare two buildinfo object.

Parameters:

other – the other object to compare with the current one.

Returns:

False if other is not a buildinfo or if other is different to the current buildinfo.

__ne__(other: object) bool

Inverse of self.__eq__.

Returns:

True if not self.__eq__(other).

get_build_data() e3.anod.store.interface.BuildDataDict

Call self.store.get_build_data.

Raises:

AttributeError – If self.store is None.

Returns:

Same as StoreReadInterface.get_build_data.

mark_ready() bool

Call self.store.mark_build_ready.

Raises:

AttributeError – If self.store is None or not a StoreWriteInterface.

Returns:

True in case of success, False otherwise.

get_source_list() list[e3.anod.store.file.File]

Get the list of source files associated to our BuildInfo object.

Raises:

AttributeError – If self.store is None.

Returns:

A list of File objects.

get_source_info(name: str, kind: str = 'source') e3.anod.store.file.File

Return the File with the given name and kind.

Parameters:
  • name – the file object name.

  • kind – the file object kind.

Raises:

AttributeError – If self.store is None.

Returns:

A File.

get_component(name: str, platform: str) e3.anod.store.component.Component

Get a component for a given build id.

Parameters:
  • name – component name

  • platform – platform

Raises:

AttributeError – If self.store is None.

Returns:

a component

get_component_list(name: str = 'all', platform: str = 'all') list[e3.anod.store.component.Component]

Get a component list for the given build id.

Parameters:
  • name – component name

  • platform – platform name

Raises:

AttributeError – If self.store is None.

Returns:

A list of Component.

classmethod previous_build_date(build_date: str) str

Given a build date return the previous one.

Parameters:

build_date – a build date

Returns:

the build date before the one passed as parameter

classmethod latest(store: e3.anod.store.interface.StoreReadInterface | e3.anod.store.interface.StoreRWInterface, setup: str, build_version: str = 'all', build_date: str | None = 'all', *, ready_only: bool = True, build_id: str | None = None, days_limit: int = 1) typing_extensions.Self

Find a build.

Parameters:
  • store – A Store instance.

  • setup – A setup name.

  • build_version – The build version.

  • build_date – The build date, in ‘YYYYMMDD’ format. If None or ‘all’, the latest BuildInfo with any date is selected.

  • ready_only – If True (default), return only build ids that are in a ready state.

  • build_id – if not None look only for the given build_id. The returned build object should match setup and optionally build_version and or build_date.

  • days_limit – if build_id is None and build_date is set then look for prior days in case there is no build at the given build_date. The parameter specify the number of days the call is allowed to look back before raising a StoreError.

Returns:

A build object.

classmethod list(store: e3.anod.store.interface.StoreReadInterface | e3.anod.store.interface.StoreRWInterface, build_date: str = 'all', setup: str = 'all', build_version: str = 'all', nb_days: int = 1) list[typing_extensions.Self]

Find a build in a date range.

Parameters:
  • store – Store instance to get build list from.

  • build_date – build date, in ‘YYYYMMDD’ format the returned build info should match (along with nb_days).

  • setup – setup the returned build info should match.

  • build_version – version the returned build info should match.

  • nb_days – maximum number of days to retrieve.

Returns:

A build object

classmethod create(store: e3.anod.store.interface.StoreRWInterface, setup: str, version: str, date: str | None = None, *, mark_ready: bool = False) typing_extensions.Self

Create a new build id.

Parameters:
  • store – The store instance to use. Must be able to write.

  • setup – setup name.

  • version – version.

  • date – build date.

  • mark_ready – Mark the buildinfo as ready after creating it.

classmethod from_id(store: e3.anod.store.interface.StoreReadInterface | e3.anod.store.interface.StoreRWInterface, build_id: str) typing_extensions.Self

Return a build object based on its id.

Parameters:
  • store – Store instance.

  • build_id – the build id.

Returns:

a BuildInfo object.

classmethod today_build_date() str

Return the today build date using the YYYYMMDD format.

The today build date is the current date minus 1 day.

classmethod wait(store: e3.anod.store.interface.StoreReadInterface | e3.anod.store.interface.StoreRWInterface, setup: str, build_date: str | None = None, timeout: float = 36000.0, retry_delay: float = 60.0) typing_extensions.Self

Wait until the today buildinfo is available.

Parameters:
  • store – the store instance used.

  • setup – the setup of the buildinfo waited.

  • build_date – the date of the build info to wait for.

  • timeout – the global amount of time to wait.

  • retry_delay – the amount of time to wait before trying again in the loop.

Returns:

a buildinfo object.

Raises:

E3Error – If the timeout is exceeded.

copy(dest_setup: str, mark_as_ready: bool = True) typing_extensions.Self

Copy the current build id into another setup.

Note that only sources elements are copied.

Parameters:
  • dest_setup – setup of new build id

  • mark_as_ready – if True mark the resulting build id as ready

Raises:

AttributeError – If self.store is None or not a StoreWriteInterface.

Returns:

a BuildInfo object

as_dict() BuildInfoDict

Return a dictionary representation of self.

Feeding to this class’ “load” method the value returned by this method creates a new BuildInfo value that is equal to self.

Returns:

The dictionary representation of self.

to_dict() BuildInfoDict

Return a dictionary representation of self.

This function is only here for compatibility purpose and will be removed later.

See also

py:meth:as_dict.