avocado.utils.software_manager package

Subpackages

Submodules

avocado.utils.software_manager.distro_packages module

avocado.utils.software_manager.distro_packages.install_distro_packages(distro_pkg_map, interactive=False)

Installs packages for the currently running distribution

This utility function checks if the currently running distro is a key in the distro_pkg_map dictionary, and if there is a list of packages set as its value.

If these conditions match, the packages will be installed using the software manager interface, thus the native packaging system if the currently running distro.

Parameters

distro_pkg_map (dict) – mapping of distro name, as returned by utils.get_os_vendor(), to a list of package names

Returns

True if any packages were actually installed, False otherwise

avocado.utils.software_manager.inspector module

avocado.utils.software_manager.inspector.SUPPORTED_PACKAGE_MANAGERS = {'apt-get': <class 'avocado.utils.software_manager.backends.apt.AptBackend'>, 'dnf': <class 'avocado.utils.software_manager.backends.dnf.DnfBackend'>, 'yum': <class 'avocado.utils.software_manager.backends.yum.YumBackend'>, 'zypper': <class 'avocado.utils.software_manager.backends.zypper.ZypperBackend'>}

Mapping of package manager name to implementation class.

class avocado.utils.software_manager.inspector.SystemInspector

Bases: object

System inspector class.

This may grow up to include more complete reports of operating system and machine properties.

Probe system, and save information for future reference.

get_package_management()

Determine the supported package management systems present on the system. If more than one package management system installed, try to find the best supported system.

avocado.utils.software_manager.main module

Software package management library.

This is an abstraction layer on top of the existing distributions high level package managers. It supports package operations useful for testing purposes, and multiple high level package managers (here called backends).

avocado.utils.software_manager.main.main()

avocado.utils.software_manager.manager module

class avocado.utils.software_manager.manager.SoftwareManager

Bases: object

Package management abstraction layer.

It supports a set of common package operations for testing purposes, and it uses the concept of a backend, a helper class that implements the set of operations of a given package management tool.

Lazily instantiate the object

static extract_from_package(package_path, dest_path=None)

Try to extract a package content into a destination directory.

It will try to see if the package is valid against all supported package managers and if any is found, then extracts its content into the extract_path.

Raises NotImplementedError when a non-supported package is used.

Parameters
  • package_path (str) – package file path.

  • dest_path (str) – destination path to extract. Default is the current directory.

Returns

destination path were the package it was extracted.

is_capable()

Checks if environment is capable by initializing the backend.

Module contents