Skip to content

Commit

Permalink
Give easy instructions for small modifications to the default compone…
Browse files Browse the repository at this point in the history
…nts.

* Rename _LEAPP_DEFAULT_COMPONENTS to GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS (More descriptive name
  and no longer private)
* Add instructions for modifying the default value of the component parameter to the
  get_leapp_packages and get_leapp_deps_packages docstrings
  • Loading branch information
abadger committed Jan 8, 2024
1 parent 5da27e8 commit a28931b
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions repos/system_upgrade/common/libraries/rpms.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class LeappComponents(object):
}
}

_LEAPP_DEFAULT_COMPONENTS = frozenset((LeappComponents.FRAMEWORK,
LeappComponents.REPOSITORY,
LeappComponents.TOOLS))
GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS = frozenset((LeappComponents.FRAMEWORK,
LeappComponents.REPOSITORY,
LeappComponents.TOOLS))


def get_installed_rpms():
Expand Down Expand Up @@ -203,7 +203,7 @@ def _get_leapp_packages_of_type(major_version, component, type_='pkgs'):
return sorted(res)


def get_leapp_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS):
def get_leapp_packages(major_version=None, component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS):
"""
Get list of leapp packages.
Expand All @@ -212,6 +212,15 @@ def get_leapp_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS):
:param component: a list or a single enum value specifying leapp components
(use enum :class: LeappComponents) If defined then only packages related to the specific
component(s) will be returned.
The default set of components is in `GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS` and
simple modifications of the default can be achieved with code like:
.. code-block:: python
get_leapp_packages(
component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS.difference(
[LeappComponents.TOOLS]
))
:raises ValueError: if a requested component or major_version doesn't exist.
.. note::
Expand All @@ -224,7 +233,7 @@ def get_leapp_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS):
return _get_leapp_packages_of_type(major_version, component, type_="pkgs")


def get_leapp_dep_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS):
def get_leapp_dep_packages(major_version=None, component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS):
"""
Get list of leapp dep metapackages.
Expand All @@ -233,6 +242,14 @@ def get_leapp_dep_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONEN
:param component: a list or a single enum value specifying leapp components
(use enum :class: LeappComponents) If defined then only packages related to the specific
component(s) will be returned.
The default set of components is in `GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS` and
simple modifications of the default can be achieved with code like:
.. code-block:: python
get_leapp_packages(
component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS.difference(
[LeappComponents.TOOLS]
))
:raises ValueError: if a requested component or major_version doesn't exist.
"""
return _get_leapp_packages_of_type(major_version, component, type_="deps")

0 comments on commit a28931b

Please sign in to comment.